small doc fix

parent 7174572e
Pipeline #120190 passed with stage
in 3 minutes and 9 seconds
......@@ -33,7 +33,7 @@ conform with the Grid5000 API models (with an 's'!)
* Comparison with ...
- [[https://api.grid5000.fr/doc/4.0/tools/restfully.html][RESTfully]]:
- [[https://api.grid5000.fr/doc/4.0/tools/restfully.html][RESTfully]]:
It consumes REST API following the [[https://en.m.wikipedia.org/wiki/HATEOAS][HATEOAS]] principles. This allows the client
to fully discover the resources and actions available. Most of the G5K API
follow theses principles but, for instance the [[https://www.grid5000.fr/mediawiki/index.php/Storage_Manager][Storage API]] don't. Thus
......@@ -41,7 +41,7 @@ conform with the Grid5000 API models (with an 's'!)
It's a ruby library. Python-grid5000 borrows the friendly syntax for resource
browsing, but in python.
- [[http://execo.gforge.inria.fr][Execo]]:
- [[http://execo.gforge.inria.fr][Execo]]:
Written in Python. The api module gathers a lot of utils functions leveraging
the Grid'5000 API. Resources aren't exposed in a syntax friendly manner,
instead functions for some classical operations are exposed (mainly getters).
......@@ -49,13 +49,13 @@ conform with the Grid5000 API models (with an 's'!)
wrapper around the Grid'5000 that seeks 100% coverage. Python-grid5000 is
resource oriented.
- [[http://docs.python-requests.org][Raw requests]]:
- [[http://docs.python-requests.org][Raw requests]]:
*The* reference for HTTP library in python. Good for prototyping but low-level.
python-grid5000 encapsulates this library.
* Installation and examples
- Please refer to [[https://api.grid5000.fr/doc/4.0/reference/spec.html]] for
- Please refer to [[https://api.grid5000.fr/doc/4.0/reference/spec.html]] for
the complete specification.
- All the examples are exported in the examples subdirectory so you can
......@@ -100,12 +100,12 @@ pip install python-grid5000
#+BEGIN_EXAMPLE
$) grid5000
Python 3.6.5 (default, Jun 17 2018, 21:32:15)
Python 3.6.5 (default, Jun 17 2018, 21:32:15)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.3.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: gk.sites.list()
Out[1]:
In [1]: gk.sites.list()
Out[1]:
[<Site uid:grenoble>,
<Site uid:lille>,
<Site uid:luxembourg>,
......@@ -115,7 +115,7 @@ Out[1]:
<Site uid:rennes>,
<Site uid:sophia>]
In [2]: # gk is your entry point
In [2]: # gk is your entry point
#+END_EXAMPLE
......@@ -447,7 +447,7 @@ In [2]: # gk is your entry point
from grid5000 import Grid5000
logging.basicConfig(level=logging.DEBUG)
......@@ -477,7 +477,7 @@ In [2]: # gk is your entry point
job.refresh()
print("Waiting the job [%s] to be runnning" % job.uid)
time.sleep(5)
vlanid = job.resources_by_type["vlans"][0]
# we hard code the interface but this can be discovered in the node info
......@@ -589,14 +589,14 @@ In [2]: # gk is your entry point
logging.basicConfig(level=logging.DEBUG)
NAME = "pyg5k"
conf_file = os.path.join(os.environ.get("HOME"), ".python-grid5000.yaml")
gk = Grid5000.from_yaml(conf_file)
sites = gk.sites.list()
site = gk.sites["rennes"]
sites = [gk.sites["rennes"], gk.sites["nancy"], gk.sites["grenoble"]]
# creates some jobs
jobs = []
for site in sites:
......@@ -687,17 +687,16 @@ In [2]: # gk is your entry point
print(clusters)
#+END_SRC
*** Using Grid'5000 client certificates
~python-grid5000~ can also be used as a trusted client with Grid'5000
internal certificate. In this mode users can pass the ~g5k_user~ argument
to most calls to specify which user the API call should be made as. In
cases where ~g5k_user~ is not specified API calls will be made as the
internal certificate. In this mode users can pass the ~g5k_user~ argument
to most calls to specify which user the API call should be made as. In
cases where ~g5k_user~ is not specified API calls will be made as the
~anonymous~ user whose access is limited to the Grid'5000 reference API.
In this mode ~python-grid5000~ does not store any login information, so
~g5k_user~ most be provided explicitly provided on every call that requires
one.
~g5k_user~ must be provided explicitly provided on every call that requires
one.
#+BEGIN_SRC python :exports code :tangle examples/certificate.py
import logging
......@@ -718,7 +717,7 @@ one.
"command": "sleep 3600"},
g5k_user = "auser1")
# Since the 'anonymous' user can not inspect jobs the following call will raise exception
# python-grid5000.exceptions.Grid5000AuthenticationError: 401 Unauthorized
job.refresh()
......@@ -728,7 +727,7 @@ one.
job.refresh(g5k_user='auser2')
# Some operations can only be performed by the jobs creator.
# The following call will raise exception
# The following call will raise exception
# pyg5k.exceptions.Grid5000DeleteError: 403 Unauthorized
job.delete(g5k_user='auser2')
......@@ -737,7 +736,7 @@ one.
#+END_SRC
* Appendix :noexport:
** How to export this file
......@@ -749,4 +748,3 @@ one.
- Produce python example scripts.
Do ~C-c C-v t~ or ~M-x
org-babel-tangle~. The scripts are available under available under ~examples~.
This diff is collapsed.
......@@ -26,7 +26,7 @@ job.refresh(g5k_user='auser1')
job.refresh(g5k_user='auser2')
# Some operations can only be performed by the jobs creator.
# The following call will raise exception
# The following call will raise exception
# pyg5k.exceptions.Grid5000DeleteError: 403 Unauthorized
job.delete(g5k_user='auser2')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment