datafed.CommandLib
Module Contents
Classes
A high-level messaging interface to the DataFed core server |
- class datafed.CommandLib.API(opts={})
A high-level messaging interface to the DataFed core server
The DataFed CommandLib.API class provides a high-level interface for sending requests to a DataFed server. Requests are sent via python class methods and replies are (currently) returned as Google Protobuf message objects. These reply messages are defined in the *.proto files included in the DataFed client package. Basic functionality of th API class mirrors the capabilities exposed in the DataFed CLI.
The Config class is used to load configuration settings, but settings (all or some) may also be supplied as an argument to the constructor. On success, a secure connection is established to the configured DataFed core server. If user credentials are installed, the associated user will be authenticated; otherwise an anonymous connection will be created. Use the getAuthUser() method to check is authentication is required after constructing an API instance.
Parameters
- optsdict, Optional
Configuration options
Attributes
- _max_md_sizeint.
Maximum size of metadata in bytes. Currently set to 102400
- _max_payload_sizeint
Maximum limit for the amount of data that can be sent in a single batch create request. Currently set to 1048576
Raises
Exception : if invalid config values are present
- _max_md_size = 102400
- _max_payload_size = 1048576
- _endpoint_legacy
- _endpoint_uuid
- getAuthUser()
Get current authenticated user, if any.
Returns current user ID If current connection is authenticated, otherwise returns None.
Returns
- str :
Authenticated user ID or None if not authenticated
- logout()
Logout current client, if any.
If connected, logs-out by reseting underlying connection and clearing current user.
Returns
None
- loginByPassword(uid, password)
Manually authenticate client by user id and password
If not authenticated, this method attempts manual authentication using the supplied DataFed user ID and password.
Parameters
- uidstr
DataFed user ID
- passwordstr
DataFed password
Returns
None
Raises
Exception : if authentication fails.
- generateCredentials()
Generate/download local user credentials
Requests the DataFed server to generate and send local credentials for the current user. These credentials should be saved/loaded from a set of public/private client keys files as specified via the Config module.
Returns
msg: Google protobuf message
Raises
Exception: On communication or server error
- repoCreate(repo_id, title=None, desc=None, domain=None, capacity=None, pub_key=None, address=None, endpoint=None, path=None, exp_path=None, admins=[])
Create a repository
Parameters
- repo_idstr
The id of the data repository i.e. “datafed-home” internally this will be represented as “repo/datafed-home”
- titlestr
A title describing the repository
- descstr
A detailed description of the repository
- domainstr
May not be needed, used by FUSE
- capacitystr
The size of the repository in bytes
- pub_keystr
The public key of the repo so the core server and repository server can communicate
- addressstr
The tcp address of the repository server, given the domain and the port i.e. “tcp://my-repo-server.cu.edu:9000”
- endpointstr
The globus UUID associated with the repository with the following format “XXXXYYYYXXXX-XXXX-XXXX-XXXX-XXXXYYYY”
- pathstr
The relative POSIX path as seen from the globus collection (endpoint) to the repositories folder which is controled by the datafed repo server. i.e. if I have a POSIX path /home/tony_stark/inventions/datafed-home and the endpoint path pointed to /home/tony_stark/inventions then the POSIX path could be set to /datafed-home, NOTE the last folder in the path must have the same name as the repo_id.
exp_path : str admins : list[str]
A list of DataFed users that will have repository admin rights on the repository. i.e. [“u/tony_stark”, “u/pepper”]
Returns
msg : RepoDataReply Google protobuf message response from DataFed
Raises
Exception : On communication or server error
- repoList(list_all: bool = False)
List all repositories
By default will only list the repos associated with the user.
- repoDelete(repo_id)
Delete a repository
Parameters
- repo_idstr
The id of the data repository
Returns
msg : AckReply
Raises
Exception : On communication or server error
- repoAllocationCreate(repo_id, subject, data_limit, rec_limit)
- repoListAllocations(repo_id)
- repoAllocationDelete(repo_id, subject)
- dataView(data_id, details=False, context=None)
View a data record
Retrieves all metadata associated with record with metadata (without raw data).
Parameters
- data_idstr
Data record ID or alias
- detailsstr, Optional. Default = False
NOT USED
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgRecordDataReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error
- dataCreate(title, alias=None, description=None, tags=None, extension=None, metadata=None, metadata_file=None, schema=None, schema_enforce=None, parent_id='root', deps=None, repo_id=None, raw_data_file=None, external=None, context=None)
Create a new data record
Create a new data record. May specify alias, containing collection, metadata, dependencies, and allocation. Raw data must be uploaded separately. Cannot use both metadata and metadata_file options.
Parameters
- titlestr
Title of record
- aliasstr, Optional. Default = None
Alias of record
- descriptionstr, Optional. Default = None
Text description of record
- tagslist of str, Optional. Default = None
Tags that describe the record
- extensionstr, Optional. Default = None
Extension for raw data file to use / override
- metadataJSON string, Optional. Default = None
Domain-specific metadata described in dictionary form. This dictionary can be nested.
- metadata_filestr, Optional. Default = None
Path to local JSON file containing domain-specific metadata
- schema: str, Optional. Default = None
Set schema ID:ver for metadata validation
- schema_enforce: bool, Optional, Default = None
Set to true to enforce metadata schema validation (i.e. fail if does not comply).
- parent_idstr, Optional. Default = “root”
ID/alias of collection within which to create this record. By default, the record will be created in the user’s root collection
- depslist, Optional. Default = None
Dependencies of this data record specified as an array of lists as [ [relation type <str>, record ID <str>], [], [] … ]. Relation types currently supported are: * “der” - Is derived from * “comp” - Is comprised of * “ver” - Is new version of
- repo_idstr, Optional. Default = None
ID of data repository to create this record in. By default, the default repository will be chosen.
- raw_data_filestr, Optional. Default = None
Raw data file as a full Globus path. Currently, this parameter can only be specified with the external flag set to true.
- externalbool, Optional. Default = None
Set to true to specify raw data for this record is external (unmanaged). Cannot be specified with repo_id.
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgRecordDataReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error
- dataUpdate(data_id, title=None, alias=None, description=None, tags=None, extension=None, metadata=None, metadata_file=None, metadata_set=False, schema=None, schema_enforce=None, deps_add=None, deps_rem=None, raw_data_file=None, context=None)
Update an existing data record
Update an existing data record. May specify title, alias, metadata, dependencies, and allocation. Raw data must be uploaded separately. Cannot use both metadata and metadata_file options.
Parameters
- data_idstr
Data record ID or alias
- titlestr
Title of record
- aliasstr, Optional. Default = None
Alias of record
- descriptionstr, Optional. Default = None
Text description of record
- tagslist of str, Optional. Default = None
Tags that describe the record
- extensionstr, Optional. Default = None
Extension for raw data file to use / override
- metadataJSON string, Optional. Default = None
Domain-specific metadata described in dictionary form. This dictionary can be nested.
- metadata_filestr, Optional. Default = None
Path to local JSON file containing domain-specific metadata
- metadata_setbool, Optional. Default = False
Set to True to replace existing metadata with provided. Otherwise, and by default, provided metadata will be merged with existing metadata.
- schema: str, Optional. Default = None
Set schema ID:ver for metadata validation
- schema_enforce: bool, Optional, Default = None
Set to true to enforce metadata schema validation (i.e. fail if does not comply).
- deps_addlist, Optional. Default = None
Dependencies of this data record to add, specified as an array of lists as [ [relation type <str>, record ID <str>], [], [] … ]. Relation types currently supported are: * “der” - Is derived from * “comp” - Is comprised of * “ver” - Is new version of
- deps_remlist, Optional. Default = None
Dependencies of this data record to remove, specified as an array of lists as [ [relation type <str>, record ID <str>], [], [] … ]. Relation types currently supported are: * “der” - Is derived from * “comp” - Is comprised of * “ver” - Is new version of
- raw_data_filestr, Optional. Default = None
Raw data file as a full Globus path. Currently, this parameter can only be specified for records with the external (unmanaged) raw data.
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgRecordDataReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error
- dataDelete(data_id, context=None)
Deletes onr or more data records and associated raw data.
Parameters
- data_idstr
Data record ID or alias
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgRecordDataReply Google protobuf message
Response from DataFed
Raises
Exception : On invalid options or communication / server error
- dataGet(item_id, path, encrypt=sdms.ENCRYPT_AVAIL, orig_fname=False, wait=False, timeout_sec=0, context=None)
Get (download) raw data for one or more data records and/or collections
This method downloads to the specified path the raw data associated with a specified data record, or the records contained in a collection, or with a list of records and/or collections. The path may be a full globus path or a full or relative local file system path (will prepend the default endpoint). If the endpoint is not local, only full paths should be specified.
Parameters
- item_idstr or list or str
Data record or collection ID/alias, or a list of IDs/aliases
- pathstr
Globus or local file system destination path
- encrypt :
Encrypt mode (none, if avail, force)
- orig_fnamebool, Optional. Default = False
If set to True, the file(s) contained in the record(s) will be downloaded with their original name(s). Otherwise, and by default, the files will be named according to their unique record ID followed by the original or overriden extension.
- waitbool, Optional. Default = False
Set to true to wait until the file transfer is complete. Otherwise, and by default, the transfer will take place in the background / asynchronously
- timeout_secint, Optional. Default = 0
Timeout in seconds for polling the status of the Globus transfer. By default, there is no timeout.
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgXfrDataReply Google protobuf message
Response from DataFed
Raises
Exception : On invalid options or communication / server error. Exception : If both Globus and HTTP transfers are required
- dataPut(data_id, path, encrypt=sdms.ENCRYPT_AVAIL, wait=False, timeout_sec=0, extension=None, context=None)
Put (upload) raw data for a data record
This method uploads raw data from the specified path to the specified data record. The upload involves a Globus transfer, and the path may be a full globus path, or a full or relative local file system path (the current endpoint will be prepended).
Parameters
- data_idstr
Data record ID or alias
- pathstr
Globus or local file system path to source file
- encrypt :
Encrypt mode (none, if avail, force)
- waitbool, Optional. Default = False
Set to true to wait until the file transfer is complete. Otherwise, and by default, the transfer will take place in the background / asynchronously
- timeout_secint, Optional. Default = 0
Timeout in seconds for polling the status of the Globus transfer. By default, there is no timeout.
- extensionstr, Optional. Default = None
Override extension of source file. By default, the extension is detected automatically.
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgXfrDataReply Google protobuf message
Response from DataFed
Raises
Exception : On invalid options or communication / server error.
- dataBatchCreate(file, coll_id=None, context=None)
Batch create data records
Create one or more data records from JSON source files that specify all metadata for the record. The source files may contain an individual JSON object, or an array of JSON objects. There is a maximum limit to the amount of data that can be sent in a single batch create request (see
_max_payload_size
attribute).Parameters
- filelist or tuple
An array of (JSON) filenames to process
- coll_idstr, Optional. Default = None
Parent collection ID/alias . Replaces parent field in JSON. By default, the parent field in the JSON file will be used.
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgRecordDataReply Google protobuf message
Response from DataFed
Raises
Exception : On invalid options or communication / server error
- dataBatchUpdate(file)
Batch update data records
Update one or more data records from JSON source files that specify all updated metadata for the record. The source files may contain an individual JSON object, or an array of JSON objects. There is a maximum limit to the amount of data that can be sent in a single batch create request (see _max_payload_size).
Parameters
- filelist or tuple
An array of filenames on local file system to process
Returns
- msgRecordDataReply Google protobuf message
Response from DataFed
Raises
Exception : On invalid options or communication / server error
- collectionView(coll_id, context=None)
View collection information
View alias, title, and description of a collection
Parameters
- coll_idstr
ID/alias of Collection to view
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgCollDataReply Google protobuf message
Response from DataFed
Raises
Exception : On invalid options or communication / server error.
- collectionCreate(title, alias=None, description=None, tags=None, topic=None, parent_id='root', context=None)
Create a new collection
Create a new collection with title, alias, and description. Note that if topic is provided, the collection and contents become publicly readable and will be presented in DataFed catalog browser.
Parameters
- titlestr
Title of collection
- aliasstr, Optional. Default = None
Alias of collection
- descriptionstr, Optional. Default = None
Text description of collection
- tagslist of str, Optional. Default = None
Tags that describe the collection
- topicstr
Scientific topics under which this collection is organized in the catalog view. If topic is added, the collection and contents become publicly readable and will be presented in DataFed catalog browser.
- parent_idstr, Optional. Default = “root”
ID/alias of collection within which to create this collection. By default, the collection will be created in the user’s root collection
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgCollDataReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error
- collectionUpdate(coll_id, title=None, alias=None, description=None, tags=None, topic=None, context=None)
Update an existing collection with title, alias, and description.
Note that if topic is added, the collection and contents become publicly readable and will be presented in DataFed catalog browser.
Parameters
- coll_idstr
ID/alias of the collection
- titlestr, Optional. Default = None
Title of collection
- aliasstr, Optional. Default = None
Alias of collection
- descriptionstr, Optional. Default = None
Text description of collection
- tagslist of str, Optional. Default = None
Tags that describe the collection
- topicstr
Scientific topics under which this collection is organized in the catalog view. If topic is added, the collection and contents become publicly readable and will be presented in DataFed catalog browser.
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgCollDataReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error
- collectionDelete(coll_id, context=None)
Delete one or more existing collections
Deletes one or more collections and contained items. When a collection is deleted, all contained collections are also deleted. However, contained data records are only deleted if they are not linked to another collection not involved in the deletion.
Parameters
- coll_idstr, or list of str
ID/alias OR list of IDs/aliases of the collection(s) to be deleted
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- msgAckReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error
- collectionItemsList(coll_id, offset=0, count=20, context=None)
List items in collection
List items linked to or contained in the specified collection.
Parameters
- coll_idstr
ID/alias of the collection
- offsetint, Optional. Default = 0
Offset of listing results for paging
- countint, Optional. Default = 20
Number (limit) of listing results for (cleaner) paging
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- ListingReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- collectionItemsUpdate(coll_id, add_ids=None, rem_ids=None, context=None)
Update (add/remove) items linked to a specified collection
Note that data records may be linked to any number of collections, but collections can only be linked to one parent collection. If a collection is added to a new parent collection, it is automatically unlinked from it’s current parent. An ancestor (parent, grandparent, etc) collection cannot be linked to a descendant collection.
Items removed from a collection that have no other parent collections are automatically re-linked to the root collection. The return reply of this method contains any such re-linked items.
Parameters
- coll_idstr
ID/alias of the collection
- add_idsstr or list of str, Optional. Default = None
ID/alias of record(s) and/or collection(s) to add
- rem_idsstr or list of str, Optional. Default = None
ID/alias of record(s) and/or collection(s) to remove
context
Returns
- ListingReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- collectionGetParents(coll_id, inclusive=False, context=None)
Get parents of specified collection up to the root collection
Parameters
- coll_idstr
ID/alias of the collection
- inclusivebool, Optional. Default = False
Set to True to include starting collection. Otherwise, and by default, starting collection is ignored.
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- CollPathReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- queryList(offset=0, count=20)
List saved queries
Parameters
- offsetint, Optional. Default = 0
Offset of listing results for paging
- countint, Optional. Default = 20
Number (limit) of listing results for (cleaner) paging
Returns
- ListingReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- queryView(query_id)
View a saved query
Parameters
- query_idstr
ID of saved query to view
Returns
QueryDataReply Google protobuf message
Raises
Exception : On communication or server error
- queryCreate(title, coll_mode=None, coll=None, id=None, text=None, tags=None, schema=None, meta=None, meta_err=None, owner=None, creator=None, time_from=None, time_to=None, public=None, category=None, sort=None, sort_rev=None)
Create a new saved query
Default scope for the search includes owned data and all data associated with owned and managed projects, as well as member projects.
Parameters
- titlestr
Title of query
- idstr, Optional. Default = None
ID/alias for query. Automatically assigned by default.
- textstr, Optional. Default = None
Text in title or description of query
- metastr, Optional. Default = None
Query expression
Returns
QueryDataReply Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
- queryUpdate(query_id, title=None, coll_mode=None, coll=None, id=None, text=None, tags=None, schema=None, meta=None, meta_err=None, owner=None, creator=None, time_from=None, time_to=None, public=None, category=None, sort=None, sort_rev=None)
Update an existing saved query
Things like the title, and the query expression can be modified. However, the scope may not be changed
Parameters
Returns
QueryDataReply Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
- queryDelete(query_id)
Delete a saved query.
Parameters
- query_idstr
ID/alias for query.
Returns
AckReply Google protobuf message
Raises
Exception : On communication or server error
- queryExec(query_id, offset=0, count=20)
Execute a stored query and return matches.
Parameters
- query_idstr
ID/alias for query.
- offsetint, Optional. Default = 0
Offset of listing results for paging
- countint, Optional. Default = 20
Number (limit) of listing results for (cleaner) paging
Returns
- ListingReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- queryDirect(coll_mode=None, coll=None, id=None, text=None, tags=None, schema=None, meta=None, meta_err=None, owner=None, creator=None, time_from=None, time_to=None, public=None, category=None, sort=None, sort_rev=None, offset=0, count=20)
Directly run a manually entered query and return matches
Parameters
- collstr, Optional. Default = None
ID(s) or alias(es) of collection(s) to add to scope
- idstr
ID/alias query text
- textstr, Optional. Default = None
Description of query
- metastr, Optional. Default = None
Query expression
Returns
- ListingReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- _buildSearchRequest(msg, coll_mode=None, coll=None, id=None, text=None, tags=None, schema=None, meta=None, meta_err=None, owner=None, creator=None, time_from=None, time_to=None, public=None, category=None, sort=None, sort_rev=None, offset=0, count=20)
- userListCollaborators(offset=0, count=20)
List collaborators. Collaborators are defined as users that have projects in common with the current user, or that have data-sharing relationships with the current user.
Parameters
- offsetint, Optional. Default = 0
Offset of listing results for paging
- countint, Optional. Default = 20
Number (limit) of listing results for (cleaner) paging
Returns
UserDataReply Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
- userListAll(offset=0, count=20)
List all users
Parameters
- offsetint, Optional. Default = 0
Offset of listing results for paging
- countint, Optional. Default = 20
Number (limit) of listing results for (cleaner) paging
Returns
UserDataReply Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
- userView(uid)
View user information
Parameters
- uidstr
ID of user to view
Returns
UserDataReply Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
- projectList(owned=True, admin=True, member=True, offset=0, count=20)
List projects associated with current user
List projects that are owned or managed by the current user, as well as projects were the current user is a member.
Parameters
- ownedbool, optional. Default = True
If True, includes owned projects. Otherwise, only includes projects owned by others that this user is part of.
- adminbool, optional. Default = True
If True, includes projects managed by this user. Otherwise, only includes projects managed by others that this user is part of.
- memberbool, optional. Default = True
If True, includes projects where the current user is a member. Otherwise, does not list such projects.
- offsetint, Optional. Default = 0
Offset of listing results for paging
- countint, Optional. Default = 20
Number (limit) of listing results for (cleaner) paging
Returns
- ListingReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- projectView(project_id)
View project information (title, description, owner, etc.)
Parameters
- project_idstr
ID of project to view
Returns
ProjectDataReply Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
- projectGetRole(project_id)
Get the role that this user plays in a given project
Parameters
- project_idstr
ID of project to view
Returns
Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
List users and/or that have shared data with client/subject.
Parameters
- inc_userslist of str, Optional. Default
Include a list of specified users
- inc_projectslist of str, Optional. Default
Include a list of specified projects
- subjectlist of str, Optional. Default
Include a list of specified subjects
Returns
ListingReply Google protobuf message
Raises
Exception : On communication or server error Exception : On invalid options
List shared data records and collections by user/project ID
Parameters
- owner_idstr
User or project ID
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
- offsetint, Optional. Default = 0
Offset of listing results for paging
- countint, Optional. Default = 20
Number (limit) of listing results for (cleaner) paging
Returns
- ListingReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- taskList(time_from=None, time_to=None, since=None, status=None, offset=0, count=20)
List recent Globus data transfer tasks
If no time or status filter options are provided, all Globus transfers initiated by the current user are listed, arranged by most recent first. Note that the DataFed server periodically purges transfer history such that only up to 30 days of history are retained.
Parameters
- time_fromstr, Optional. Default = None
Start date/time for listing specified as M/D/YYYY[,HH:MM]
- time_tostr, Optional. Default = None
End date/time for listing specified as M/D/YYYY[,HH:MM]
- since: str, Optional. Default = None
List from specified time string (second default, suffix h = hours, d = days, w = weeks)
status : list of str and/or int. Default = None offset : int, Optional. Default = 0
Offset of matching results for paging
- countint, Optional. Default = 20
Number (limit) of matching results for (cleaner) paging
Returns
- XfrDataReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- taskView(task_id=None)
View information regarding a (Globus data transfer) task
Parameters
- task_idstr, Optional. Default = None
Task ID to view. If specified, information regarding the requested task is returned. Otherwise and by default, information regarding the latest task initiated by the current user is returned.
Returns
- TaskDataReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error Exception : On invalid options
- endpointListRecent()
List recently used Globus endpoints
Returns
- UserGetRecentEPReply Google protobuf message
Response from DataFed
Raises
Exception : On communication or server error
- endpointDefaultGet()
Get configured default endpoint
Returns
- str
default endpoint string, or None if not configured
- endpointDefaultSet(endpoint)
Set the default Globus endpoint (used to set initial current endpoint)
Parameters
- endpointstr
New default endpoint
- endpointGet()
Get current Globus endpoint
Returns
- str
current endpoint string, or None if not set
- endpointSet(endpoint)
Set current Globus endpoint (added to partial get/put paths)
Parameters
- endpointstr
New current Globus endpoint
- setupCredentials()
Setup local credentials
This command installs DataFed credentials for the current user in the configured client configuration directory. Subsequent use of the DataFed API will read these credentials instead of requiring manual authentication.
Returns
None
Raises
Exception : On communication or server error Exception : On invalid options
- setContext(item_id=None)
Set current context which is used to resolve relative aliases
Parameters
- item_idstr, optional. Default = None
A user or project ID. By default, this user’s ID will be used as the context
Returns
None
Raises
Exception : On communication or server error Exception : On invalid options
- getContext()
Gets the current context which is used to resolve relative aliases
Returns
- str
The current user or project ID context string
- timestampToStr(ts)
Convert timestamp into standard string format
Parameters
- tstime.struct_time
Timestamp in local time
Returns
- str
A string representation of the timestamp in local time
- strToTimestamp(time_str)
Convert a date/time string into the integer value of the represented timestamp (in local time)
Parameters
- time_strstr
Date/time in %m/%d/%Y[,%H:%M[:%S]] format
Returns
- int
The integer timestamp representation of the time string
- sizeToStr(size, precision=1)
Convert integer size of data sizes to human readable size string with metric units
Parameters
- sizeint
size of data file
- precisionint, optional. defaut = 1
Precision of converted value
Returns
- str
The size as a string with byte units
- _uniquifyFilename(path)
Ensures that the provided file name is unique by generating a new unique file name if the specified file name already exists.
Parameters
- pathstr or Pathlib path
path to file of interest
Returns
- str
Unique file path
- _resolvePathForHTTP(path)
Resolve relative local path
Parameters
- pathstr
User specified relative path
Returns
- str
Path ready for HTTP
- _resolvePathForGlobus(path, must_exist)
Resolve relative paths and prefix with current endpoint if needed
Parameters
- pathstr
file path
- must_existbool
Whether or not the path must exist
Returns
- str
Path with globus endpoint UUID or alias prefixed.
- _resolve_id(item_id, context=None)
Resolve ID by prefixing relative aliases with current or specifies context
Parameters
- item_idstr
ID of record, project, user or collection
- contextstr, Optional. Default = None
User ID or project ID to use for alias resolution.
Returns
- str
resolved ID
- _setSaneDefaultOptions()
Set any missing config options to sane defaults
Returns
- optsdict
Automatically determined save configuration options