Jobs can be submitted and results retrieved using a python 3 client library. Each API service has a separate The client object which is constructed with the following arguments:can be constructed on one of two ways:
If you construct the client with no arguments, the config values stored in$HOME/.engine_config.json
when you ran cyrus init
will be used
Code Block |
---|
from engine import EngineClient
client = EngineClient() |
Alternately you can configure the client manually
client_id — The client ID obtained from https://api-authorization.cyrusbio.com/
secret — The secret obtained from https://api-authorization.cyrusbio.com/
server — The address of your Cyrus API server. This will be provided to you during onboarding
port — The Cyrus API server port, you should use port 443 unless otherwise instructed during onboarding.
...
Code Block |
---|
from engine.antibody_hm.client import AntibodyHMClientEngineClient client = AntibodyHMClientEnglineClient( client_id="client_id", secret="secret", server="engine.customername.cyrusbio.com", port=443) |
Once the client is constructed it can be used to submit jobs and retrieve results
Submitting Jobs
The client.submit() method is used to submit jobs. Each job type will have different parameters. See the documentation for the job type you are interested in.
The job ID returned by the submit() method can be used to retrieve the results of the job
...
There for each API service, the client provides a submit_<servicename>
method. For example, to submit an epitope scan job:
Code Block |
---|
mhc_list = ["H-2-IAb"]
sequence = "NLYIQWLKDGGPSSGRPPPS"
job_id = client.submit_epitope_scan(mhc_list=mhc_list, sequence=sequence) |
Retrieving job results
You can get the status of the job by running:
Code Block |
---|
client.get_status(job_id) |
where job_id
is the object returned by a submit_
method
The client.get_results() method will not return your results until the job is complete. Once complete, this method will return an object dictionary containing the results. The results object will have attributes for each file produced by the API job. For example, to download the “models” file “csv” artifact produced by the epitope scan API to the directory “output_dir/” you could use code like this:
Code Block |
---|
results = client.get_results(job_id) results.models["csv"].dump(“output_dir/”) |