ordflow.api.API¶
- class ordflow.api.API(api_key, server_url=None)[source]¶
Bases:
object
Creates an instance of the API class to communicate with DataFlow
- Parameters
Methods
Create a new dataset
Show information about a dataset
Search for a dataset in DataFlow
Upload the provided file to the specified Dataset.
Search for individual files in datasets
Activates Globus endpoints necessary to transfer data.
Checks whether both source and destination Globus endpoints are active
Show information about an Instrument
List all instruments connected to this DataFlow server
Gets current default user settings
Set or update default user settings
- dataset_create(title, instrument_id=0, metadata=None)[source]¶
Create a new dataset
- Parameters
title (str) – Title for dataset
instrument_id (int, optional) – Instrument ID. Default = 0 - UnknownInstrument
metadata (dict, optional) – Scientific metadata associated with this dataset. Metadata specified as {“param 1”: value_1, “param 2”: value_2} Nested dictionaries will be flattened with keys joined with a “-” separator
- Returns
Response from POST request
- Return type
- file_upload(file_path, dataset_id, relative_path=None, transport=None)[source]¶
Upload the provided file to the specified Dataset.
- Parameters
file_path (str) – Local path to file that needs to be uploaded
dataset_id (int) – Dataset ID to upload this file to
relative_path (str, optional) – Relative path in destination to place this file. Default - the file will be uploaded to the root directory of the dataset
transport (ordflow.Transport, optional) – Transport protocol to use to transfer this specific file
- Returns
Response from POST request
- Return type
- globus_endpoints_activate(username, password, encrypted=True, endpoint='destination')[source]¶
Activates Globus endpoints necessary to transfer data.
Notes
It is entirely possible that the source and destination endpoints are in different security enclaves in the same organization or even in different organizations. For now, the “source” endpoint typically uses ORNL XCAMS credentials (your three-character ID and password). By default, the “destination” endpoint points to ORNL’s CADES Open-Research Network File System, which also uses ORNL XCAMS credentials.
- Parameters
username (str) – user name associated with the specified endpoint
password (str) – password associated with specified endpoint
encrypted (bool, Optional) – Whether or not the password is encrypted (using the DataFlow web server’s encryption). Default = encrypted password
endpoint (str, Optional) – Endpoint to activate. The 3 valid options are: 1. “source” - DataFlow server’s endpoint, 2. “destination” - Where data will be sent to, and 3. the UUID of some other endpoint
- Returns
Response from GET request
- Return type
- globus_endpoints_active(endpoint=None)[source]¶
Checks whether both source and destination Globus endpoints are active
- instrument_list()[source]¶
List all instruments connected to this DataFlow server
- Returns
Response from GET request
- Return type
- settings_get()[source]¶
Gets current default user settings
- Returns
Response from GET request
- Return type