slycat.web.server

slycat.web.server.check_https_get_remote_ip()[source]

checks that the connection is https and then returns the users remote ip :return: remote ip

slycat.web.server.check_rules(groups)[source]
slycat.web.server.check_user(session_user, apache_user, couchdb, sid, session)[source]

check to see if the session user is equal to the apache user raise 403 and delete the session if they are not equal :param session_user: user_name in the couchdb use session :param apache_user: user sent in the apache header “authuser” :param couchdb: hook to couch :param sid: session id :param session: session object from couch :return:

slycat.web.server.checkjob(sid, jid)[source]

Submits a command to the slycat-agent to check the status of a submitted job to a cluster running SLURM.

Parameters:
  • sid (int) – Session identifier
  • jid (int) – Job identifier
Returns:

response – A dictionary with the following keys: jid, status, errors

Return type:

dict

slycat.web.server.clean_up_old_session()[source]

try and delete any outdated sessions for the user if they have the cookie for it :return:no-op

slycat.web.server.create_session(hostname, username, password)[source]

Create a cached remote session for the given host.

Parameters:
  • hostname (string) – Name of the remote host to connect via SSH.
  • username (string) – Username for SSH authentication.
  • password (string) – Password for SSH authentication
Returns:

sid – A unique session identifier.

Return type:

string

slycat.web.server.create_single_sign_on_session(remote_ip, auth_user)[source]

WSGI/RevProxy no-login session creations. Successful authentication and access verification, create a session and return. :return: not used

slycat.web.server.decode_username_and_password()[source]

decode the url from the json that was passed to us :return: decoded url and password as a tuple

slycat.web.server.delete_model_parameter(database, model, aid)[source]

Delete a model parameter in the couch database :param database: :param model: model from the couchdb :param aid: artifact id :return: not used

slycat.web.server.evaluate(hdf5_array, expression, expression_type, expression_level=0)[source]

Evaluate a hyperchunk expression.

slycat.web.server.get_model_file(database, model, aid)[source]
slycat.web.server.get_model_lock(model_id)[source]
slycat.web.server.get_model_parameter(database, model, aid)[source]
slycat.web.server.get_password_function()[source]
slycat.web.server.get_remote_file(sid, path)[source]

Returns the content of a file from a remote system.

Parameters:
  • sid (int) – Session identifier
  • path (string) – Path for the requested file
Returns:

content – Content of the requested file

Return type:

string

slycat.web.server.get_remote_file_server(client, sid, path)[source]

Returns the content of a file from a remote system.

Parameters:
  • sid (int) – Session identifier
  • path (string) – Path for the requested file
Returns:

content – Content of the requested file

Return type:

string

slycat.web.server.mix(a, b, amount)[source]

Linear interpolation between two numbers. Useful for computing model progress.

slycat.web.server.post_model_file(mid, input=None, sid=None, path=None, aid=None, parser=None, client=None, **kwargs)[source]
slycat.web.server.put_model_array(database, model, aid, array_index, attributes, dimensions)[source]

store array for model

Parameters:
  • database – database of model
  • model – model as an object
  • aid – artifact id (eg data-table)
  • array_index – index of the array
  • attributes – name and type in column
  • dimensions – number of data rows
Returns:

slycat.web.server.put_model_arrayset(database, model, aid, input=False)[source]

Start a new model array set artifact. :param database: the database with our model :param model: the model :param aid: artifact id :param input: :return:

slycat.web.server.put_model_arrayset_data(database, model, aid, hyperchunks, data)[source]

Write data to an arrayset artifact.

Parameters:
  • database (database object, required) –
  • model (model object, required) –
  • aid (string, required) – Unique (to the model) arrayset artifact id.
  • hyperchunks (string or hyperchunks parse tree, required) – Specifies where the data will be stored, in Hyperchunks format.
  • data (iterable, required)) – A collection of numpy.ndarray data chunks to be stored. The number of data chunks must match the number implied by the hyperchunks parameter.
slycat.web.server.put_model_file(database, model, aid, value, content_type, input=False)[source]
slycat.web.server.put_model_inputs(database, model, source, deep_copy=False)[source]
slycat.web.server.put_model_parameter(database, model, aid, value, input=False)[source]
slycat.web.server.response_url()[source]

get the resonse_url and clean it to make sure that we are not being spoofed :return: url to route to once signed in

slycat.web.server.ssh_connect(hostname=None, username=None, password=None)[source]
slycat.web.server.update_model(database, model, **kwargs)[source]

Update the model, and signal any waiting threads that it’s changed. will only update model base on “state”, “result”, “started”, “finished”, “progress”, “message”