slycat.web.server.handlers

slycat.web.server.handlers.clear_ssh_sessions()[source]

clears out of the ssh session for the current user

slycat.web.server.handlers.create_project_data(mid, aid, file)[source]

creates a project level data object that can be used to create new models in the current project :param mid: model ID :param aid: artifact ID :param file: file attachment :return: not used

slycat.web.server.handlers.delete_job(hostname, jid)[source]
slycat.web.server.handlers.delete_model(mid)[source]
slycat.web.server.handlers.delete_model_parameter(mid, aid)[source]

delete a model artifact :param mid: model Id :param aid: artifact id :return:

slycat.web.server.handlers.delete_project(pid)[source]

Deletes a project and all its models.

Parameters:{string} -- project id (pid) –
slycat.web.server.handlers.delete_project_cache(pid)[source]

clears all the cached images and videos for a project given a project ID :param pid: Project ID :return: status

slycat.web.server.handlers.delete_project_cache_object(pid, key)[source]

Deletes an object from the project cache.

Parameters:
  • {string} -- project id (pid) –
  • {string} -- key in the cache (key) –
Raises:

cherrypy.HTTPError – 404 not found

slycat.web.server.handlers.delete_reference(rid)[source]
slycat.web.server.handlers.delete_remote(sid)[source]

TODO: this function needs review for deprecation as we no longer send the sid over

Deletes a remote session created with POST /api/remotes

Parameters:{string} -- unique session id (sid) –
slycat.web.server.handlers.delete_upload(uid)[source]

Delete an upload session used to upload files for storage as model artifacts. This function must be called once the client no longer needs the session, whether the upload(s) have been completed successfully or the client is cancelling an incomplete session.

status 204
The upload session and any temporary storage have been deleted.
status 409
The upload session cannot be deleted, because parsing is in progress. Try again later.
Parameters:uid – upload sessin id
Returns:not used
slycat.web.server.handlers.get_bookmark(bid)[source]

Retrieves a bookmark - an arbitrary collection of client state.

Parameters:{string} -- bookmark id (bid) –
Returns:json – representation of client state
slycat.web.server.handlers.get_checkjob(hostname, jid)[source]
slycat.web.server.handlers.get_configuration_ga_tracking_id()[source]
slycat.web.server.handlers.get_configuration_injected_code()[source]
slycat.web.server.handlers.get_configuration_markings()[source]
slycat.web.server.handlers.get_configuration_parsers()[source]
slycat.web.server.handlers.get_configuration_remote_hosts()[source]
slycat.web.server.handlers.get_configuration_support_email()[source]
slycat.web.server.handlers.get_configuration_version()[source]
slycat.web.server.handlers.get_configuration_wizards()[source]
slycat.web.server.handlers.get_job_output(hostname, jid, path)[source]
slycat.web.server.handlers.get_model(mid, **kwargs)[source]
slycat.web.server.handlers.get_model_array_attribute_chunk(mid, aid, array, attribute, **arguments)[source]
slycat.web.server.handlers.get_model_arrayset_data(mid, aid, hyperchunks, byteorder=None)[source]

Retrieve data stored in arrayset darray attributes. The caller may request data stored using any combination of arrays, attributes, and hyperslices.

Parameters:
  • {string} -- model id (mid) –
  • {string} -- artifact id (aid) –
  • {string} -- The request must contain a parameter (hyperchunks) – hyperchunks that specifies the arrays, attributes, and hyperslices to be returned, in Hyperchunks format.
Keyword Arguments:
 

{string} -- optional byteorder argument must (byteorder) – be big or little. (default: {None})

Raises:
  • cherrypy.HTTPError – 400 aid is not an array artifact.
  • cherrypy.HTTPError – 400 Not a valid hyperchunks specification
  • cherrypy.HTTPError – 400 optional byteorder argument must be big or little.
  • cherrypy.HTTPError – 404 aid not found
Returns:

octet-stream – application/octet-stream

slycat.web.server.handlers.get_model_arrayset_metadata(mid, aid, **kwargs)[source]

Used to retrieve metadata and statistics for an arrayset artifact - a collection of dense, multidimensional darray objects. A darray is a dense, multi-dimensional, multi-attribute array, suitable for storage of arbitrarily-large data.

The metadata for a single darray includes the name, type, half-open range of coordinate values, and shape for each dimension in the array, plus the name and type of each attribute.

Statistics can be retrieved for individual darray attributes, and include minimum and maximum values, plus a count of unique values for an attribute. Although statistics are cached, retrieving them may be an extremely expensive operation, since they involve full scans through their respective attributes. Because of this, callers are encouraged to retrieve statistics only when needed.

Parameters:
  • {string} -- model id (mid) –
  • {string} -- artifact id (aid) –
Raises:
  • cherrypy.HTTPError – 404
  • cherrypy.HTTPError – 400 aid is not an array artifact.
  • cherrypy.HTTPError – 400 Not a valid hyperchunks specification.
Returns:

json – statistical results of arrayset

slycat.web.server.handlers.get_model_file(mid, aid)[source]
slycat.web.server.handlers.get_model_parameter(mid, aid)[source]
slycat.web.server.handlers.get_model_statistics(mid)[source]

returns statistics on the model :param mid: model ID :return json: {

“mid”:mid, “hdf5_file_size”:hdf5_file_size, “total_server_data_size”: total_server_data_size, “hdf5_store_size”:total_hdf5_server_size, “model”:model, “delta_creation_time”:delta_creation_time, “couchdb_doc_size”: sys.getsizeof(model)

}

slycat.web.server.handlers.get_model_table_chunk(mid, aid, array, rows=None, columns=None, index=None, sort=None)[source]
slycat.web.server.handlers.get_model_table_metadata(mid, aid, array, index=None)[source]
slycat.web.server.handlers.get_model_table_sorted_indices(mid, aid, array, rows=None, index=None, sort=None, byteorder=None)[source]
slycat.web.server.handlers.get_model_table_unsorted_indices(mid, aid, array, rows=None, index=None, sort=None, byteorder=None)[source]
slycat.web.server.handlers.get_project(pid)[source]

returns a project based on “content-type” header :param pid: project ID :return: Either html landing page of given project or the json representation of the project

slycat.web.server.handlers.get_project_cache_object(pid, key)[source]
slycat.web.server.handlers.get_project_file_names(pid)[source]
slycat.web.server.handlers.get_project_models(pid, **kwargs)[source]
slycat.web.server.handlers.get_project_references(pid)[source]
slycat.web.server.handlers.get_projects_list(_=None)[source]

returns an array of projects :param _: :return:

slycat.web.server.handlers.get_remote_file(hostname, path, **kwargs)[source]

Given a hostname and file path returns the file given by the path :param hostname: connection host name :param path: path to file :param kwargs: :return: file

slycat.web.server.handlers.get_remote_host_dict()[source]
slycat.web.server.handlers.get_remote_image(hostname, path, **kwargs)[source]

Given a hostname and image path returns the image given by the path :param hostname: connection host name :param path: path to image :param kwargs: :return: image

slycat.web.server.handlers.get_remote_job_status(hostname, jid)[source]
slycat.web.server.handlers.get_remote_show_user_password()[source]

checks to see if the application needs to show password :return: json {show:bool, msg:msg}

slycat.web.server.handlers.get_remote_video(hostname, vsid)[source]

Given a hostname and vsid returns the video given by the vsid :param hostname: connection host name :param vsid: video uuid :return: video

slycat.web.server.handlers.get_remote_video_status(hostname, vsid)[source]

Given a hostname and vsid returns the video status given by the vsid :param hostname: connection host name :param vsid: video uuid :return: json

slycat.web.server.handlers.get_remotes(hostname)[source]

Returns {status: True} if the hostname was found in the user’s session :param hostname: connection host name :return: {“status”:status, “msg”:msg}

slycat.web.server.handlers.get_root()[source]

TODO: this function may be deprecated with the webpack move Redirect all requests to “/” to “/projects” Not sure why we used to do that, but after conversion to webpack this is no longer needed, so I changed the projects-redirect config parameter in web-server-config.ini to just “/”

slycat.web.server.handlers.get_session_status(hostname)[source]
slycat.web.server.handlers.get_sid(hostname)[source]

Takes a hostname address and returns the established sid value base on what is found in the users session raises 400 and 404 :param hostname: name of the host we are trying to connect to :return: sid : uuid for the session name

slycat.web.server.handlers.get_table_metadata(file, array_index, index)[source]

Return table-oriented metadata for a 1D array, plus an optional index column.

slycat.web.server.handlers.get_table_sort_index(file, metadata, array_index, sort, index)[source]
slycat.web.server.handlers.get_time_series_names(hostname, path, **kwargs)[source]

Parse a time series csv for all column names :param hostname: connection host name :param path: path to csv file :param kwargs: :return: json object of column names

slycat.web.server.handlers.get_user(uid, time)[source]
slycat.web.server.handlers.get_user_config(hostname)[source]
slycat.web.server.handlers.job_time(nodes, tasks, size)[source]

gives the time in seconds recommended given job meta data :param nodes: number of hpc nodes for job :param tasks: number of tasks per node for job :param size: size of data file used in the job :return: json time in seconds as an integer {‘time-seconds’: 1800}

slycat.web.server.handlers.login()[source]

Takes the post object under cherrypy.request.json with the users name and password and determins with the user can be authenticated with slycat :return: authentication status

slycat.web.server.handlers.logout()[source]

See if the client has a valid session. If so delete it :return: the status of the request

slycat.web.server.handlers.model_command(mid, type, command, **kwargs)[source]

Execute a custom model command.

Plugins may register custom commands to be executed on the server, using an existing model as context. Custom commands are used to perform computation on the server instead of the client, and would typically use model artifacts as inputs.

Parameters:
  • {string} -- model id (mid) –
  • {string} -- Unique command category. (type) –
  • {string} -- Custom command name. (command) –
Raises:

cherrypy.HTTPError – 400 Unknown command:

Returns:

any – whatever the registered command

slycat.web.server.handlers.model_sensitive_command(mid, type, command)[source]
slycat.web.server.handlers.open_id_authenticate(**params)[source]

takes the openid parameter sent to this function and logs in a user :param params: openid params as a dictionary :return: not used

slycat.web.server.handlers.post_events(event)[source]
slycat.web.server.handlers.post_log()[source]

send post json {“message”:”message”} to log client errors onto the client server :return:

slycat.web.server.handlers.post_model_arrayset_data(mid, aid)[source]

get the arrayset data based on aid, mid, byteorder, and hyperchunks

requires hyperchunks to be included in the json payload

Parameters:
  • mid – model id
  • aid – artifact id
Returns:

stream of data

slycat.web.server.handlers.post_model_files(mid, input=None, files=None, sids=None, paths=None, aids=None, parser=None, **kwargs)[source]
slycat.web.server.handlers.post_model_finish(mid)[source]
slycat.web.server.handlers.post_project_bookmarks(pid)[source]
slycat.web.server.handlers.post_project_models(pid)[source]

When a pid along with json “model-type”, “marking”, “name” is sent with POST creates a model and saves it to the database :param pid: project ID for created model :return: json {“id” : mid}

slycat.web.server.handlers.post_project_references(pid)[source]
slycat.web.server.handlers.post_projects()[source]

creates a new project :raises: cherrypy.HTTPError – if the project name is missing from the post json raises 400

Returns:[json] – project id that was created
slycat.web.server.handlers.post_remote_browse(hostname, path)[source]
slycat.web.server.handlers.post_remote_command(hostname)[source]

run a remote command from the list of pre-registered commands that are located on a remote agent. :param hostname: name of the hpc host :return: {

“message”: a message that is supplied by the agent, “command”: an echo of the command that was sent to the server and the agent, “error”: boolean describing if there was an agent error, “available_scripts”: [{

“name”: script_name, “description”: script_description, “parameters”: [{

“name”: parameter_name as string, “description”: description of the param string, “example”:example usage string, “type”: field type eg string, int…

}]

}]list of available scripts from the agent

}

slycat.web.server.handlers.post_remote_launch(hostname)[source]
slycat.web.server.handlers.post_remotes()[source]

Given username, hostname, password as a json payload establishes a session with the remote host and attaches it to the users session :return: {“sid”:sid, “status”:boolean, msg:”“}

slycat.web.server.handlers.post_submit_batch(hostname)[source]
slycat.web.server.handlers.post_upload_finished(uid)[source]

ask the server to finish the upload :param uid: upload session ID :return: status of upload

slycat.web.server.handlers.post_uploads()[source]

creates a session for uploading a file to :return: Upload ID

slycat.web.server.handlers.put_model(mid)[source]
slycat.web.server.handlers.put_model_arrayset(mid, aid)[source]
slycat.web.server.handlers.put_model_arrayset_array(mid, aid, array)[source]
slycat.web.server.handlers.put_model_arrayset_data(mid, aid, hyperchunks, data, byteorder=None)[source]
slycat.web.server.handlers.put_model_inputs(mid)[source]
slycat.web.server.handlers.put_model_parameter(mid, aid)[source]
slycat.web.server.handlers.put_project(pid)[source]

Takes json in the format of {

‘acl’:{ ‘administrators’: [{‘user’:’username’}] ‘writers’: [{‘user’:’username’}] ‘readers’: [{‘user’:’username’}] }, ‘name’: ‘name of the project’, ‘description’: ‘description of the project’,

} and updates the project json from this object. all top order fields are optional :param pid {string} – uui for project:

Raises:
  • cherrypy.HTTPError – 400 missing administrators
  • cherrypy.HTTPError – 400 missing writers
  • cherrypy.HTTPError – 400 missing readers
slycat.web.server.handlers.put_project_csv_data(pid, file_key, parser, mid, aids)[source]

returns a project based on “content-type” header :param pid: project ID :param file_key: file_name :param parser: parser name :param mid: model ID :param aids: artifact IDs :return: status 404 if no file found or with json {“Status”: “Success”}

slycat.web.server.handlers.put_reference(rid)[source]
slycat.web.server.handlers.put_upload_file_part(uid, fid, pid, file=None, hostname=None, path=None)[source]
slycat.web.server.handlers.require_array_json_parameter(name)[source]
slycat.web.server.handlers.require_boolean_json_parameter(name)[source]
slycat.web.server.handlers.require_integer_array_json_parameter(name)[source]
slycat.web.server.handlers.require_integer_parameter(value, name)[source]
slycat.web.server.handlers.require_json_parameter(name)[source]

checks to see if the parameter is in the cherrypy.request.json and errors gracefully if it is not there :param name: name of json param :return: value of the json param

slycat.web.server.handlers.run_agent_function(hostname)[source]
slycat.web.server.handlers.set_user_config(hostname)[source]
slycat.web.server.handlers.tests_request(*arguments, **keywords)[source]
slycat.web.server.handlers.validate_table_byteorder(byteorder)[source]
slycat.web.server.handlers.validate_table_columns(columns)[source]
slycat.web.server.handlers.validate_table_rows(rows)[source]
slycat.web.server.handlers.validate_table_sort(sort)[source]