Skip to main content

EduceLab Globus module

Project description

EduceLab Globus

PyPI version Python versions Tests Documentation Status License: AGPL v3

educelab-globus is a Python module and command-line toolkit for logging into and transferring data between Globus endpoints. It wraps globus-sdk with a small configuration file, named endpoints, and three ergonomic CLI commands that make scripted transfers between lab and archive systems straightforward.

Features

  • A simple TOML-based config of named Globus endpoints with optional default base directories
  • A login command that acquires and caches tokens, prompts for any required consents (including data_access and session/MFA requirements), and falls back automatically to a headless flow on remote shells
  • A cp-style command for copying files and directories between endpoints, with progress reporting, sync modes, optional checksum verification, and a background submit mode
  • A small Python API for use from other tools and pipelines

Requirements

Installation

This project is available on PyPI:

python3 -m pip install educelab-globus

Quick start

1. Configure your endpoints

Named Globus endpoints are stored in ~/.globuscp/config.toml:

[lab-server]
uuid = "16fd2706-8baf-433b-82eb-8c7fada847da"
basedir = "/mnt/scratch/"  # optional, defaults to /

[archive]
uuid = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
basedir = "/cold/"

basedir is optional. When omitted, absolute paths must be given explicitly on the command line and relative paths are not allowed.

You can also use the interactive editor:

el-globus-config --edit

2. Log in

el-globus-login

Tokens are cached in ~/.globuscp/tokenstore.json. Subsequent commands reuse them until they expire or an endpoint requires new consents.

3. Transfer data

el-globus-cp lab-server:data/experiment-01 archive:backups/2024/experiment-01

CLI reference

# List configured endpoints
el-globus-config

# Interactively add, edit, or delete endpoints
el-globus-config --edit

# Login to Globus and cache access tokens
el-globus-login

# Login for specific endpoints only
el-globus-login --endpoints endpoint-name-or-uuid [...]

# Force a new login, even if cached tokens are valid
el-globus-login --force

# Print the auth URL instead of opening a browser (useful over SSH)
el-globus-login --no-browser

# Transfer a file or directory between two endpoints.
# Paths may be absolute or relative to the endpoint's basedir.
el-globus-cp src-endpoint:/path/to/source dst-endpoint:/path/to/dest

# Examples
el-globus-cp lab-server:data/experiment-01 archive:backups/2024/experiment-01
el-globus-cp lab-server:/mnt/scratch/run42 archive:/cold/run42

# Only transfer files that have changed (other choices: exists, size, checksum)
el-globus-cp --sync-level mtime src:data/ dst:data/

# Enable checksum verification
el-globus-cp --verify src:data/ dst:data/

# Background mode: exit immediately after submitting the transfer
el-globus-cp --background src:data/ dst:data/

All commands accept --verbose/-v and --quiet/-q to control log output.

Python API

from educelab.globus import login, endpoints, get_endpoint

# List configured endpoints
print(endpoints())

# Look up a single endpoint by name
ep = get_endpoint('lab-server')

# Log in and obtain a globus_sdk.TransferClient
tc = login([ep['uuid']])

See the full API documentation for details.

Documentation

Full documentation is hosted on Read the Docs: https://educelab-globus.readthedocs.io

License

This project is licensed under the GNU Affero General Public License v3.0. See LICENSE and NOTICE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

educelab_globus-1.0.0.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

educelab_globus-1.0.0-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file educelab_globus-1.0.0.tar.gz.

File metadata

  • Download URL: educelab_globus-1.0.0.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for educelab_globus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e08b51b87d61e864797fd0b62ee0ac1fa3f50b390178eb2d7932f6baf11988dd
MD5 29bccc60caf795825844678453088fcd
BLAKE2b-256 846abe52b7b55e10ed125f07f080b1cfe877ff9f52df89e782b23cd8707a3c92

See more details on using hashes here.

Provenance

The following attestation bundles were made for educelab_globus-1.0.0.tar.gz:

Publisher: publish.yml on educelab/educelab-globus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file educelab_globus-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: educelab_globus-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for educelab_globus-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23947adf8a847e2d6994e177e945e0bc800411812968a77880f3b2d8938312c0
MD5 2dab63aa7a2d622cd7add3560b7f079a
BLAKE2b-256 222fad042ddce728770676d55477e5a3bcb72b970a90f5aadca051d1d2e0397d

See more details on using hashes here.

Provenance

The following attestation bundles were made for educelab_globus-1.0.0-py3-none-any.whl:

Publisher: publish.yml on educelab/educelab-globus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page