Skip to main content


Project description

Add select files or directories to a bundle of files, generate a manifest, and upload or download from an SFTP server. For use with DSMS.

Please note that filepackages are not thread safe. It is up to you to ensure that only one process is manipulating a package at any point in time. For this reason, it’s recommended that you use a uuid such as the Celery task ID to ensure each process has its own space.

How to use when writing a new package:

from dsmsfilepackager.filepackage import DSMSFilePackage
import uuid

fpack = DSMSFilePackage(target_id=111, job_id=13244, uid=uuid.uuid4(),
                        hostport="1222", username="theuser",

# register in manifest

fpack.finish_and_upload()  # generate a manifest and upload

Once package generation has finished, the files will be both locally at /tmp/cache/111/13244/[uuid], as well as on the FTP server under /upload_target/111/13244/[uuid].

Now, other processes can either access the locally cached files if they’re available, or they’ll be fetched via SFTP and moved into the local cache if not.

How to fetch a previously stored package:

 # auto-get remote files, reading from cache when available

 >>> fpack = filepackage.fetch(target_id=111, job_id=13244, uid=uuid.uuid4(),
                               hostport="1222", username="theuser",
 >>> print fpack.manifest.files
 ["myfile.txt", "docs/readme.txt", "docs/"]
 >>> file_info = fpack.manifest.get("myfile.txt")
 >>> file_info.size
 >>> file_info.sha256
 >>> file_info.type
"Python script, ASCII text executable"
 >> fh ="myfile.txt")  # will be made available locally

Project details

Download files

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

Files for dsmsfilepackager, version 0.1.14
Filename, size File type Python version Upload date Hashes
Filename, size dsmsfilepackager-0.1.14.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page