slycat.web.client¶
-
class
slycat.web.client.
ArgumentParser
(*arguments, **keywords)[source]¶ Bases:
argparse.ArgumentParser
Return an instance of argparse.ArgumentParser, pre-configured with arguments to connect to a Slycat server.
-
class
slycat.web.client.
Connection
(host='http://localhost:8092', **keywords)[source]¶ Bases:
object
Encapsulates a set of requests to the given host. Additional keyword arguments must be compatible with the Python Requests library, http://docs.python-requests.org/en/latest
-
delete_model
(mid)[source]¶ Delete an existing model.
Parameters: mid (string, required) – The unique model identifier. See also
-
delete_project
(pid)[source]¶ Delete an existing project.
Parameters: pid (string, required) – The unique project identifier. See also
-
delete_project_cache_object
(pid, key)[source]¶ Delete an existing project cache object.
Parameters: - pid (string, required) – The unique project identifier.
- key (string, required) – Unique cache object key.
See also
-
delete_reference
(rid)[source]¶ Delete an existing reference.
Parameters: rid (string, required) – The unique reference identifier. See also
DELETE /references/(rid)
-
delete_remote
(sid)[source]¶ Delete an existing remote session.
Parameters: sid (string, required) – The unique remote session identifier. See also
-
find_or_create_project
(name, description='')[source]¶ Return a project identified by name, or newly created.
Parameters: - name (string, required) – The name of the project to return (or create).
- description (string, optional) – Description to use for the new project (if a new project is created).
Returns: pid – Unique identifier of the matching (or newly created) project.
Return type: string
Raises: Exception
– If more than one project matches the given name.See also
-
find_project
(name)[source]¶ Return a project identified by name.
Parameters: name (string, required) – The name of the project to return. Returns: project Return type: The matching project, which is an arbitrary collection of JSON-compatible data. Raises: Exception
– If a project with a matching name can’t be found, or more than one project matches the name.See also
-
get_bookmark
(bid)[source]¶ Retrieve an existing bookmark.
Parameters: bid (string, required) – The unique bookmark identifier. Returns: bookmark – The bookmark object, which is an arbitrary collection of JSON-compatible data. Return type: object See also
-
get_configuration_markings
()[source]¶ Retrieve marking information from the server.
Returns: markings Return type: server marking information. See also
GET /configuration/markings
-
get_configuration_parsers
()[source]¶ Retrieve parser plugin information from the server.
Returns: parsers Return type: server parser plugin information. See also
GET /configuration/parsers
-
get_configuration_remote_hosts
()[source]¶ Retrieve remote host information from the server.
Returns: parsers Return type: server remote host information. See also
GET /configuration/remote-hosts
-
get_configuration_support_email
()[source]¶ Retrieve support email information from the server.
Returns: parsers Return type: server support email information. See also
GET /configuration/support-email
-
get_configuration_version
()[source]¶ Retrieve version information from the server.
Returns: version Return type: server version information. See also
GET /configuration/version
-
get_configuration_wizards
()[source]¶ Retrieve wizard plugin information from the server.
Returns: version Return type: server wizard plugin information. See also
GET /configuration/wizards
-
get_model
(mid)[source]¶ Retrieve an existing model.
Parameters: mid (string, required) – The unique model identifier Returns: model – The model object, which is an arbitrary collection of JSON-compatible data. Return type: object See also
-
get_model_arrayset_metadata
(mid, aid, arrays=None, statistics=None, unique=None)[source]¶ Retrieve metadata describing an existing model arrayset artifact.
Parameters: - mid (string, required) – The unique model identifier.
- aid (string, required) – The unique artifact identifier.
- arrays (string, optional) – A set of arrays, specified using HQL.
- statistics (string, optional) – A set of attributes, specified using HQL.
- unique (string, optional) – A set of attributes, specified using HQL.
Returns: metadata – The arrayset metadata, which is an arbitrary collection of JSON-compatible data.
Return type: object
-
get_model_parameter
(mid, aid)[source]¶ Retrieve a model parameter artifact.
Model parameters are JSON objects of arbitrary complexity. They are stored directly within the model as part of its database record, so they should be limited in size (larger data should be stored using arraysets or files).
Parameters: - mid (string, required) – Unique model identifier.
- aid (string, required) – Unique (within the model) artifact id.
Returns: parameter
Return type: JSON-compatible object
See also
-
get_project
(pid)[source]¶ Retrieve an existing project.
Parameters: pid (string, required) – Unique project identifier. Returns: project Return type: Arbitrary collection of JSON-compatible data. See also
-
get_project_cache_object
(pid, key)[source]¶ Retrieve an object from a project cache.
Parameters: - pid (string, required) – Unique project identifier.
- key (string, required) – Cache object identifier.
Returns: content
Return type: Cached object content.
See also
-
get_projects
()[source]¶ Retrieve all projects.
Returns: projects Return type: List of projects. Each project is an arbitrary collection of JSON-compatible data. See also
-
get_remote_file
(sid, path, cache=None, project=None, key=None)[source]¶ Retrieve a file using a remote session.
Parameters: - sid (string, required) – Unique remote session identifier.
- path (string, required) – Remote filesystem path (must be absolute).
- cache (string, optional) – Optional server-side cache for the retrieved file. Must be None or “project”.
- project (string, optional) – If cache is set to “project”, this must specify a unique project identifier.
- key (string, optional) – if cache is set to “project”, this must specify a unique key for the cached object.
Returns: file
Return type: Remote file contents.
See also
-
get_remote_image
(sid, path, cache=None, project=None, key=None)[source]¶ Retrieve an image using a remote session.
Parameters: - sid (string, required) – Unique remote session identifier.
- path (string, required) – Remote filesystem path (must be absolute).
- cache (string, optional) – Optional server-side cache for the retrieved image. Must be None or “project”.
- project (string, optional) – If cache is set to “project”, this must specify a unique project identifier.
- key (string, optional) – if cache is set to “project”, this must specify a unique key for the cached object.
Returns: image
Return type: Remote image contents.
See also
-
get_user
(uid=None)[source]¶ Retrieve directory information about an existing user.
Parameters: uid (string, optional) – Unique user identifier. If unspecified, returns information about the user making the call. Returns: user Return type: Arbitrary collection of JSON-compatible data. See also
-
join_model
(mid)[source]¶ Wait for a model to complete before returning.
A Slycat model goes through several distinct phases over its lifetime:
- The model is created.
- Input artifacts are pushed into the model.
- The model is marked “finished”.
- Optional one-time computation is performed on the server, storing output artifacts.
- The model is complete and ready to be viewed.
Use this function in scripts that have performed steps 1, 2, and 3 and need to wait until step 4 completes.
Parameters: mid (string, required) – Unique model identifier. Notes
A model that hasn’t been finished will never complete - you should ensure that post_model_finish() is called successfully before calling join_model().
See also
-
post_model_files
(mid, aids, files, parser, input=True, parameters={})[source]¶ Stores a model file artifacts.
-
post_model_finish
(mid)[source]¶ Notify the server that a model is fully initialized.
When called, the server will perform one-time computation for the given model type.
Parameters: mid (string, required) – Unique model identifier. See also
-
post_project_bookmarks
(pid, bookmark)[source]¶ Store a bookmark.
Parameters: - pid (string, required) – Unique project identifier.
- bookmark (object) – Arbitrary collection of JSON-compatible data.
Returns: bid – Unique bookmark identifier.
Return type: string
See also
-
post_project_models
(pid, mtype, name, marking='', description='')[source]¶ Creates a new model, returning the model ID.
-
post_project_references
(pid, name, mtype=None, mid=None, bid=None)[source]¶ Store a project reference.
Parameters: - pid (string, required) – Unique project identifier.
- name (string, required) – Reference name.
- mtype (string, optional) – Optional model type.
- mid (string, optional) – Optional model identifier.
- bid (string, optional) – Optional bookmark identifier.
Returns: rid – Unique reference identifier.
Return type: string
See also
POST /projects/(pid)/references
-
post_remote_browse
(sid, path, file_reject=None, file_allow=None, directory_allow=None, directory_reject=None)[source]¶
-
put_model_arrayset
(mid, aid, input=True)[source]¶ Starts a new model array set artifact, ready to receive data.
-
put_model_arrayset_array
(mid, aid, array, dimensions, attributes)[source]¶ Starts a new array set array, ready to receive data.
-
put_model_arrayset_data
(mid, aid, hyperchunks, data, force_json=False)[source]¶ Write data to an arrayset artifact on the server.
Parameters: - mid (string, required) – Unique model identifier.
- aid (string, required) – Unique (to the model) arrayset artifact id.
- hyperchunks (string, required) – Specifies where the data will be stored, in Hyperchunks format.
- data (iterable, required)) – A collection of numpy.ndarray data chunks to be uploaded. The number of data chunks must match the number implied by the hyperchunks parameter.
- force_json (bool, optional)) – Force the client to upload data using JSON instead of the binary format.
-
put_model_parameter
(mid, aid, value, input=True)[source]¶ Store a model parameter artifact.
Model parameters are JSON objects of arbitrary complexity. They are stored directly within the model as part of its database record, so they should be limited in size (larger data should be stored using arraysets or files).
To get the value of a parameter artifact, use
get_model()
and read the value directly from the model record. An artifact id foo will be accessible in the record as model[“artifact:foo”].Parameters: - mid (string, required) – Unique model identifier.
- aid (string, required) – Unique (within the model) artifact id.
- value (object, required) – An arbitrary collection of JSON-compatible data.
- input (boolean, optional) – Marks whether this artifact is a model input.
See also
-
request
(method, path, **keywords)[source]¶ Makes a request with the given HTTP method and path, returning the body of the response. Additional keyword arguments must be compatible with the Python Requests library, http://docs.python-requests.org/en/latest
-
update_model
(mid, **kwargs)[source]¶ Update model state.
This function provides a more convenient alternative to
put_model()
.See also
-