Python client reference¶
-
class
nmpi.
Client
(username=None, password=None, job_service='https://nmpi.hbpneuromorphic.eu/api/v2/', quotas_service='https://quotas.hbpneuromorphic.eu', token=None, verify=True)¶ Client for interacting with the Neuromorphic Computing Platform of the Human Brain Project.
This includes submitting jobs, tracking job status and retrieving the results of completed jobs.
- Arguments:
username, password: credentials for accessing the platform. Not needed in Jupyter notebooks within the HBP Collaboratory. job_service: the base URL of the platform Job Service. Generally the default value should be used. quotas_service: the base URL of the platform Quotas Service. Generally the default value should be used. token: when you authenticate with username and password, you will receive a token which can be used in place of the password until it expires. verify: in case of problems with SSL certificate verification, you can set this to False, but this is not recommended.
-
user_info
¶ Information about the current user, as retrieved from the Collaboratory
-
submit_job
(source, platform, collab_id, config=None, inputs=None, command='run.py {system}', tags=None, wait=False)¶ Submit a job to the platform.
- Arguments:
source: the Python script to be run, the URL of a public version control repository containing Python code, a zip file containing Python code, or a local directory containing Python code. platform: the neuromorphic hardware system to be used. Either “BrainScaleS” or “SpiNNaker”. collab_id: the ID of the collab to which the job belongs config: (optional) a dictionary containing configuration information for the hardware platform. See the Platform Guidebook for more details. inputs: a list of URLs for datafiles needed as inputs to the simulation. command: (optional) the path to the main Python script relative to the root of the repository or zip file. Defaults to “run.py {system}”. tags: (optional) a list of tags (strings) describing the job. wait: (default False) if True, do not return until the job has completed, if False, return immediately with the job id. - Returns:
- The job id as a relative URI unless wait=True, in which case returns the job as a dictionary.
- Notes:
- If the source argument is a directory containing Python code, the directory contents will be uploaded to Collab storage into a folder named according to the property client.collab_source_folder (default: “source_code”)
-
job_status
(job_id)¶ Return the current status of the job with ID job_id (integer or URI).
-
get_job
(job_id, with_log=True)¶ Return full details of the job with ID job_id (integer or URI).
-
remove_completed_job
(job_id)¶ Remove a job from the interface.
The job is hidden rather than being permanently deleted.
-
remove_queued_job
(job_id)¶ Remove a job from the interface.
The job is hidden rather than being permanently deleted.
-
queued_jobs
(verbose=False)¶ Return the list of jobs belonging to the current user in the queue.
- Arguments:
verbose: if False, return just the job URIs, if True, return full details.
-
completed_jobs
(collab_id, verbose=False)¶ Return the list of completed jobs in the given collab.
- Arguments:
verbose: if False, return just the job URIs, if True, return full details.
-
download_data
(job, local_dir='.', include_input_data=False)¶ Download output data files produced by a given job to a local directory.
- Arguments:
job: a full job description (dict), as returned by get_job(). local_dir: path to a directory into which files shall be saved. include_input_data: also download input data files.
-
copy_data_to_storage
(job_id, destination='collab')¶ Copy the data produced by the job with id job_id to Collaboratory storage or to the HPAC Platform. Note that copying data to an HPAC site requires that you have an account for that site.
Example:
To copy data to the JURECA machine:
client.copy_data_to_storage(90712, "JURECA")
To copy data to Collab storage:
client.copy_data_to_storage(90712, "collab")
-
create_data_item
(url)¶ Register a data item with the platform.
-
create_resource_request
(title, collab_id, abstract, description=None, submit=False)¶ Create a new resource request. By default, it will not be submitted.
-
edit_resource_request
(request_id, title=None, abstract=None, description=None, submit=False)¶ Edit and/or submit an unsubmitted resource request
-
list_resource_requests
(collab_id, status=None)¶ Return a list of resource requests for the Neuromorphic Platform
-
list_quotas
(collab_id)¶ Return a list of quotas for running jobs on the Neuromorphic Platform
-
my_collabs
()¶ Return a list of collabs of which the user is a member.