Skip to main content

hpc-interact

Used for scripting file transfer (sftp) and sending commands (ssh) to hpc - a wrapper for expect

Requires expect

If needed, install via:

$ sudo apt install expect

Install

From PyPI:

pip install hpc-interact

Or just clone the repo and use hpc_interact.py directly.

Usage

Instantiate a Scripter object:

>>> # Connect via sftp
>>> from hpc_interact import Scripter
>>> scripter = Scripter(config="./login_config", site='somewhere.uni.edu', mode='sftp')
>>> # NOTE: If "./login_config" doesn't exist, you'll be prompted to create it

Prepare any steps to undertake

>>> outdir = "/Users/me/somedir"
>>> scripter.cwd("/some/remote/directory")
>>> for file in ["file1.txt","file2.txt"]:
...     scripter.get(file,outdir)

To see what steps you've added, run:

>>> scripter.preview_steps()

Output:

Command preview:
(0, 'cd /some/remote/directory\n')
(1, 'mkdir /Users/me/somedir\n')
(2, 'cd /Users/me/somedir\n')
(3, 'put file1.txt \n\n')
(4, 'mkdir /Users/me/somedir\n')
(5, 'cd /Users/me/somedir\n')
(6, 'put file2.txt \n\n')

To run:

>>> scripter.run()

Forgot something but don't want to create a new Scripter object?

>>> scripter.clear()
>>> scripter.put("/Users/me/another-dir/cool_script.sh",outdir="/some/remote/directory",new_name="coolest_script_on_the_hpc.sh")
>>> scripter.run()

Run a script on the cluster

>>> # Connect via ssh
>>> from hpc_interact import cluster.Scripter
>>> scripter = Scripter(config="./login_config", site='somewhere.uni.edu', mode='ssh')
>>> 
>>> # run it
>>> scripter.basic_step("bash","/some/remote/directory/coolest_script_on_the_hpc.sh")
>>> scripter.run()

Started as ssh but want need to transfer files?

>>> scripter.reset_mode("sftp")
>>> add_some_steps(scripter)
>>> scripter.run()

Metadata

Release files for hpc-interact 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hpc-interact 0.1.1
File Size Uploaded Provenance Actions
hpc_interact-0.1.1.tar.gz 8.1 kB Without provenance Details for hpc_interact-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hpc-interact 0.1.1
File Interpreter ABI Platform Actions
hpc_interact-0.1.1-py3-none-any.whl Python 3 none any Details for hpc_interact-0.1.1-py3-none-any.whl

Total release size: 16.9 kB

Release files / hpc_interact-0.1.1.tar.gz

Download URL hpc_interact-0.1.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c9f20161d826badb0f59b8517412d851cc0432b687f03066eab88f75bf6e9dab
BLAKE2b-256 checksum
How to use checksums
91099c224ae40f5f541b2ecf2bddc9337f96957e4ab4aecf49ef92071035684d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.8.16 Linux/4.4.0-22621-Microsoft

Release files / hpc_interact-0.1.1-py3-none-any.whl

Download URL hpc_interact-0.1.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87143a371871fb31259527474e6c6eb3b2669b86df2882733f29aeacaa927522
BLAKE2b-256 checksum
How to use checksums
aa095c483d4accc32cccddf521ae05a8a08fda4329909ab612e85211dd95b355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.8.16 Linux/4.4.0-22621-Microsoft

Security for hpc-interact 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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