Python API
The educelab.globus package exposes a small Python API for use from
scripts and pipelines.
from educelab.globus import login, endpoints, get_endpoint
# Inspect the configuration
for name, ep in endpoints().items():
print(name, ep['uuid'])
# Log in and get an authorized TransferClient
ep = get_endpoint('lab-server')
tc = login([ep['uuid']])
for item in tc.operation_ls(ep['uuid']):
print(item['name'])
educelab.globus
EduceLab Globus: configuration and helpers for Globus endpoint transfers.
- educelab.globus.endpoints()[source]
Return all configured endpoints keyed by name.
Each value is a dict containing at least
uuidand optionallybasedir. An empty dict is returned if no config file exists.- Return type:
- educelab.globus.get_endpoint(key)[source]
Return the config entry for the named endpoint, or
Noneif missing.
- educelab.globus.login(endpoint_uuids, force=False, ignore_offline=False, browser=True)[source]
Log into Globus and return a
TransferClientauthorized for the given endpoints.Acquires (or refreshes) tokens, prompts for any required consents or session credentials (re-running the auth flow up to five times), and verifies that each endpoint is reachable via
operation_ls.- Parameters:
endpoint_uuids (iterable of str) – UUIDs of the Globus endpoints to authorize.
force (bool, optional) – Force a new login even if cached tokens are valid. Default
False.ignore_offline (bool, optional) – Treat offline (
GCDisconnected) endpoints as non-fatal. DefaultFalse.browser (bool, optional) – Use the local-server (browser) login flow. Automatically disabled on remote/SSH sessions. Default
True.
- Returns:
An authorized transfer client.
- Return type:
- Raises:
RuntimeError – If any endpoint could not be authorized after the retry budget is exhausted (e.g. user did not satisfy a session requirement).
educelab.globus.config
- educelab.globus.config.edit_mode()[source]
Interactive CLI menu for editing the Globus endpoint config.
- Return type:
None
- educelab.globus.config.endpoint_uuids()[source]
Return the list of UUIDs for all configured endpoints.
- educelab.globus.config.endpoints()[source]
Return all configured endpoints keyed by name.
Each value is a dict containing at least
uuidand optionallybasedir. An empty dict is returned if no config file exists.- Return type:
- educelab.globus.config.get_endpoint(key)[source]
Return the config entry for the named endpoint, or
Noneif missing.
educelab.globus.login
- educelab.globus.login.login(endpoint_uuids, force=False, ignore_offline=False, browser=True)[source]
Log into Globus and return a
TransferClientauthorized for the given endpoints.Acquires (or refreshes) tokens, prompts for any required consents or session credentials (re-running the auth flow up to five times), and verifies that each endpoint is reachable via
operation_ls.- Parameters:
endpoint_uuids (iterable of str) – UUIDs of the Globus endpoints to authorize.
force (bool, optional) – Force a new login even if cached tokens are valid. Default
False.ignore_offline (bool, optional) – Treat offline (
GCDisconnected) endpoints as non-fatal. DefaultFalse.browser (bool, optional) – Use the local-server (browser) login flow. Automatically disabled on remote/SSH sessions. Default
True.
- Returns:
An authorized transfer client.
- Return type:
- Raises:
RuntimeError – If any endpoint could not be authorized after the retry budget is exhausted (e.g. user did not satisfy a session requirement).