fdi.pns package

Subpackages

Submodules

fdi.pns.config module

fdi.pns.fdi_requests module

fdi.pns.fdi_requests.delete_from_server(urn, poolurl, contents='product')[源代码]

Remove a product or pool from server

urn: to extract poolname, product type, and index if any of these are needed poolurl: the only parameter must be provided

fdi.pns.fdi_requests.getAuth(user='foo', password='bar')[源代码]
fdi.pns.fdi_requests.put_on_server(urn, poolurl, contents='pool')[源代码]

Register the pool on the server.

urn: to extract poolname, product type, and index if any of these are needed poolurl: the only parameter must be provided

fdi.pns.fdi_requests.read_from_server(urn, poolurl, contents='product')[源代码]

Read product or hk data from server

urn: to extract poolname, product type, and index if any of these are needed poolurl: the only parameter must be provided

fdi.pns.fdi_requests.save_to_server(data, urn, poolurl, tag, no_serial=False)[源代码]

Save product to server with putting tag in headers

data: goes to the request body urn: to extract poolname, product type, and index if any of these are needed poolurl: the only parameter must be provided tag: go with the produc

ts into the pool

no_serial: do not serialize the data.

fdi.pns.fdi_requests.urn2fdiurl(urn, poolurl, contents='product', method='GET')[源代码]

Returns URL for accessing pools with a URN.

See up-to-date HttpPool API UI at http://<ip>:<port>/apidocs.

This is done by using the PoolURL.

contents: ‘product’ for returning a product from the pool. ‘hk’ for returning the housekeeping data of the pool. ‘classes’ for returning the class housekeeping data of the pool. ‘urns’ for returning the URN housekeeping data of the pool. ‘tags’ for returning the tag housekeeping data of the pool.

method: ‘GET’ compo for retrieving product or hk or classes, urns, tags, ‘POST’ compo for uploading product ‘PUT’ for registering pool ‘DELETE’ compo for removing product or removing pool

Example: IP=ip poolpath=/a poolname=b files=/a/b/classes.jsn | urns.jsn | t.. | urn…

with python: m.refs[‘myinput’] = special_ref ref=pstore.save(m) assert ref.urn == ‘urn:b:fdi.dataset.MapContext:203’ p=ref.product myref=p.refs[‘myinput’]

with a pool: myref=pool.load(’http://ip:port/v0.6/b/fdi.dataset.MapContext/203/refs/myinput’)

fdi.pns.jsonio module

fdi.pns.jsonio.auth_headers(username, password, headers=None)[源代码]
fdi.pns.jsonio.deleteJsonObj(url, obj, headers)[源代码]

deletes object from url. Returns None if fails.

fdi.pns.jsonio.getJsonObj(url, headers=None, usedict=True, **kwds)[源代码]

return object from url. url can be http or file. translate keys and values from string to number if applicable. Raise exception if fails. Not using requests.get() as it cannot open file:/// w/o installing https://pypi.python.org/pypi/requests-file

fdi.pns.jsonio.getJsonObj1(url, headers=None, usedict=False)[源代码]

return object from url. url can be http or file. translate keys and values from string to number if applicable. Return None if fails. Not using requests.get() as it cannot open file:/// w/o installing https://pypi.python.org/pypi/requests-file

fdi.pns.jsonio.jsonREST(url, obj, headers, cmd)[源代码]

generic RESTful command handler for POST, PUT, and DELETE.

fdi.pns.jsonio.postJsonObj(url, obj, headers)[源代码]

posts object to url. Returns None if fails.

fdi.pns.jsonio.putJsonObj(url, obj, headers)[源代码]

puts object to url. Returns None if fails.

fdi.pns.jsonio.writeJsonObj(o, fn)[源代码]

Write an object to file fn in json safely Return True if successful else False

fdi.pns.logdict module

fdi.pns.pns_server module

fdi.pns.runflaskserver module

fdi.pns.runflaskserver.setuplogging(level=30)[源代码]

fdi.pns.server_skeleton module

fdi.pns.urlconf module

fdi.pns.urlconf.urn2url(urn, contents='product')[源代码]

Returns URL for accessing pools with a URN.

contents: ‘product’ for returning a product from the pool. ‘hk’ for returning the housekeeping data of the pool. ‘classes’ for returning the class housekeeping data of the pool. ‘urns’ for returning the URN housekeeping data of the pool. ‘tags’ for returning the tag housekeeping data of the pool.

Example: IP=ip dir=/a/b/c files=/a/b//c/classes.jsn | urns.jsn | t.. | urn…

with python: m.refs[‘myinput’] = special_ref ref=pstore.save(m) assert ref.urn == ‘urn:http://ip:port/a/b/c/fdi.dataset.MapContext:203’ p=ref.product myref=p.refs[‘myinput’]

with a pool: myref=pool.load(’http://ip:port/v0.6/a/b/c/fdi.dataset.MapContext/203/refs/myinput’)

urn:http://ip:port/a/b/c/fdi.dataset.Product:203 ==> http://ip:port/v0.6/a/b/c/fdi.dataset.Product/203/meta/OBSID

At the same time this is not allowed due to overlapping after ‘c’

urn:http://ip:port/a/b/d/fdi.dataset.Product:203 ==> http://ip:port/v0.6/a/b/c/d/

This is also overlapping starting from ‘/’

urn:http://ip:port/fdi.dataset.Product:203 ==> http://ip:port/v0.6/

but for example this is allowed:

urn:http://ip:port/a/k/fdi.dataset.Product:203 ==> http://ip:port/v0.6/a/k/