Skip to main content

Version Status Downloads

Open-like context managers for remote globus files.

glopen(filename, mode, endpoint):

  1. Creates a temporary file

  2. [On a read mode:] Transfers the remote file to the temporary file

  3. Opens the temporary file with the given mode

  4. Yields the open temporary file

  5. Closes the temporary file

  6. [On a write mode:] Transfers the temporary file to the remote file

  7. Deletes the temporary file

glopen_many(filenames, mode, endpoint) takes a list of filenames and yeilds a list of open files. The remote copies are grouped into a single globus transfer, improving performance for small files.

Example

>>> from glopen import glopen
>>> with glopen("path/to/remote/file.anything", mode="r",
                endpoint="globusid#endpoint") as f:
...     lines = f.readlines()

>>> from glopen import glopen_many
>>> files = ["file1", "file2", "file3"]
>>> with glopen_many(files, mode="w", endpoint="globusid#endpoint") as fs:
...     for f,d in zip(fs,d):
...         f.write(d)

Install

glopen is on the Python Package Index (PyPI):

pip install glopen

It depends on globussh, a light-weight wrapper around the globus SSH interface. Your local machine must be a globus endpoint, so you can either run Globus connect personal or Globus connect server.

Configuration

glopen transfers files to and from a temporary directory on your local machine, so it needs to know the machine’s endpoint name and a directory that globus can access. You tell glopen the endpoint and temporary directory in a ~/.glopen config file:

{
  "local_endpoint" : "<globusid>#<endpoint_name>",
  "tempdir" : "/home/<username>/tmp"
}

Download files

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

Source Distribution

glopen-0.0.12.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file glopen-0.0.12.tar.gz.

File metadata

  • Download URL: glopen-0.0.12.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for glopen-0.0.12.tar.gz
Algorithm Hash digest
SHA256 cf946d170b37cfd30d8afdf5ce8b202eab1b6e7cae16210e6957cb838d7579a0
MD5 302b196abff7e6b981f0c35174726b9d
BLAKE2b-256 c5f5a49806625bd9550ea21280021339a55c3c39d8ae5c494035602b48a8f08f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.12 This release

1 file

0.0.11

1 file

0.0.10

1 file

0.0.9

1 file

0.0.8

1 file

0.0.7

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page