fdi.pns package

Subpackages

Submodules

fdi.pns.jsonio module

fdi.pns.jsonio.deleteJsonObj(url, obj, headers)

deletes object from url. Returns None if fails.

fdi.pns.jsonio.getJsonObj(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. 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.pnsconfig module

fdi.pns.runflaskserver module

fdi.pns.runflaskserver.setuplogging()

fdi.pns.server module

fdi.pns.server.bad_request(error)
fdi.pns.server.calc(d)

generates result product directly using data on PNS.

fdi.pns.server.calcresult(cmd, ops='')
fdi.pns.server.checkpath(path)

Checks the directories for data exchange between pns server and pns PTS.

fdi.pns.server.cleanPTS(d)

Removing traces of past runnings the Processing Task Software.

fdi.pns.server.cleanup(cmd)

DELETE is used to clean up the Processing Task Software (PST) to its initial configured state.

fdi.pns.server.configPNS(d=None)

Configure the PNS itself by replacing the pnsconfig var

fdi.pns.server.configPTS(d=None)

Configure the Processing Task Software by running the config script. Ref init PTS.

fdi.pns.server.defaultprocessinput(data)

puts all undecoded json to every files.

fdi.pns.server.defaultprocessoutput(filemode)

reads each of the files and returns the contents in a filename indexed dict.

fdi.pns.server.dosleep(indata, ops)

run ‘sleep [ops]’ in the OS. ops is 3 if not given.

fdi.pns.server.filesin(dir)

returns names and contents of all files in the dir, ‘None’ if dir not existing.

fdi.pns.server.genposttestprod(d)

generate post test product. put the 1st input (see maketestdata in test_pns.py) parameter to metadata and 2nd to the product’s dataset

fdi.pns.server.getConfig(conf='pns')

Imports a dict named [conf]config defined in ~/.config/[conf]local.py

fdi.pns.server.getUidGid(username)

returns the UID and GID of the named user.

fdi.pns.server.get_apis()
fdi.pns.server.getinfo(cmd)

returns init, config, run input, run output.

fdi.pns.server.initPTS(d=None)

Initialize the Processing Task Software by running the init script defined in the config. Execution on the server host is in the pnshome directory and run result and status are returned. If input/output directories cannot be created with serveruser as owner, Error401 will be given.

fdi.pns.server.makepublicAPI(ops)
fdi.pns.server.not_found(error)
fdi.pns.server.run(d, processinput=None, processoutput=None)

Generates a product by running script defined in the config under ‘run’. Execution on the server host is in the pnshome directory and run result and status are returned.

fdi.pns.server.setOwnerMode(p, username)

makes UID and GID set to those of serveruser given in the config file. This function is usually done by the initPTS script.

fdi.pns.server.setup(cmd, ops='')

PUT is used to initialize or configure the Processing Task Software (PST).

fdi.pns.server.testinit(d=None)

Renames the ‘init’ ‘config’ ‘run’ ‘clean’ scripts to ‘.save’ and points it to the ‘.ori’ scripts.

fdi.pns.server.testrun(d)
fdi.pns.server.unauthorized(error)
fdi.pns.server.uploadScript(op, d=None)
fdi.pns.server.verify(username, password)

This function is called to check if a username / password combination is valid.