2.1. wc_utils package¶
2.1.1. Subpackages¶
- 2.1.1.1. wc_utils.config package
- 2.1.1.2. wc_utils.data_logs package
- 2.1.1.3. wc_utils.debug_logs package
- 2.1.1.4. wc_utils.util package
- 2.1.1.4.1. Subpackages
- 2.1.1.4.2. Submodules
- 2.1.1.4.3. wc_utils.util.decorate_default_data_struct module
- 2.1.1.4.4. wc_utils.util.dict module
- 2.1.1.4.5. wc_utils.util.enumerate module
- 2.1.1.4.6. wc_utils.util.environ module
- 2.1.1.4.7. wc_utils.util.files module
- 2.1.1.4.8. wc_utils.util.git module
- 2.1.1.4.9. wc_utils.util.list module
- 2.1.1.4.10. wc_utils.util.misc module
- 2.1.1.4.11. wc_utils.util.rand module
- 2.1.1.4.12. wc_utils.util.stats module
- 2.1.1.4.13. wc_utils.util.string module
- 2.1.1.4.14. wc_utils.util.testing module
- 2.1.1.4.15. wc_utils.util.types module
- 2.1.1.4.16. wc_utils.util.uniform_seq module
- 2.1.1.4.17. wc_utils.util.units module
- 2.1.1.4.18. Module contents
- 2.1.1.5. wc_utils.workbook package
2.1.2. Submodules¶
2.1.3. wc_utils._version module¶
2.1.4. wc_utils.cache module¶
Caching
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2018-03-30
- Copyright
2018, Karr Lab
- License
MIT
-
class
wc_utils.cache.
Cache
(directory='/root/.wc/cache/', hash_block_size=65536, **kwargs)[source]¶ Bases:
diskcache.fanout.FanoutCache
Cache that shards keys (including the file content of keys that represent file names) and values
-
memoize
(name=None, typed=False, expire=None, tag=None, filename_args=None, filename_kwargs=None)[source]¶ Memoizing cache decorator
- Parameters
name (
str
, optional) – name given for callabletyped (
bool
, optional) – cache different types separatelyexpire (
float
, optional) – seconds until arguments expiretag (
str
, optional) – text to associate with argumentsfilename_args (
list
, optional) – list of indices of arguments that represent filenamesfilename_kwargs (
list
, optional) – list of keys of keyword arguments that represent filenames
- Returns
callable decorator
- Return type
types.FunctionType
-
-
wc_utils.cache.
memoize
(name=None, typed=False, expire=None, tag=None, filename_args=None, filename_kwargs=None)[source]¶ Memoizing cache decorator
- Parameters
name (
str
, optional) – name given for callabletyped (
bool
, optional) – cache different types separatelyexpire (
float
, optional) – seconds until arguments expiretag (
str
, optional) – text to associate with argumentsfilename_args (
list
, optional) – list of indices of arguments that represent filenamesfilename_kwargs (
list
, optional) – list of keys of keyword arguments that represent filenames
- Returns
callable decorator
- Return type
types.FunctionType
2.1.5. wc_utils.quilt module¶
High-level interface for the Quilt data revisioning system
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2019-10-08
- Copyright
2018-2019, Karr Lab
- License
MIT
-
class
wc_utils.quilt.
QuiltManager
(path=None, namespace=None, package=None, hash=None, registry=None, username=None, password=None, aws_bucket=None, aws_profile=None)[source]¶ Bases:
object
Manager for Quilt packages
Quilt credentials and configuration can be stored in a wc_utils configuration file (e.g., ~/.wc/wc_utils.cfg) or passed to the constructor:
[wc_utils] [[quilt]] username = ... password = ... aws_bucket = ... aws_profile = ...
AWS S3 credentials should be stored in ~/.aws/credentials:
[default] aws_access_key_id = ... aws_secret_access_key = ...
AWS S3 regions should be configured in ~/.aws/config:
[default] region=us-east-1 output=json
-
delete_file_from_bucket
(key)[source]¶ Delete file to AWS S3 bucket
- Parameters
key (
str
) – path within bucket to save file
-
delete_package
(del_from_bucket=True)[source]¶ Delete package
- Parameters
del_from_bucket (
bool
, optional) – ifTrue
, delete the files for the package from the AWS bucket
-
download_file_from_bucket
(key, path)[source]¶ Get file from AWS S3 bucket
- Parameters
key (
str
) – path within bucket to filepath (
str
) – path to save file
-
download_package
(path=None)[source]¶ Download package, or a path within a package, to local directory
- Parameters
path (
str
, optional) – path within a package to download
-
get_aws_bucket_uri
()[source]¶ Get the full URI of an AWS S3 bucket (s3:// + bucket id)
- Returns
full URI of an AWS S3 bucket
- Return type
str
-
get_full_package_id
()[source]¶ Get the full id of a package (namespace and package id)
- Returns
full package id
- Return type
str
-
get_packages
()[source]¶ Get the names of the packages in the S3 bucket
- Returns
list of package names
- Return type
list
ofstr
-