diff --git a/src/toil/jobStores/fileJobStore.py b/src/toil/jobStores/fileJobStore.py index 71729ddd05..e945b6db5b 100644 --- a/src/toil/jobStores/fileJobStore.py +++ b/src/toil/jobStores/fileJobStore.py @@ -499,7 +499,7 @@ def update_file(self, file_id, local_path): atomic_copy(local_path, jobStoreFilePath) - def read_file(self, file_id, local_path, symlink=False): + def read_file(self, file_id: str, local_path: str, symlink: bool = False) -> None: self._check_job_store_file_id(file_id) jobStoreFilePath = self._get_file_path_from_id(file_id) localDirPath = os.path.dirname(local_path) diff --git a/src/toil/utils/toilClean.py b/src/toil/utils/toilClean.py index e9a019ea21..69392182aa 100644 --- a/src/toil/utils/toilClean.py +++ b/src/toil/utils/toilClean.py @@ -22,9 +22,9 @@ def main() -> None: - parser = parser_with_common_options(jobstore_option=True) + parser = parser_with_common_options(jobstore_option=True, prog="toil clean") - options = parser.parse_args(prog="toil clean") + options = parser.parse_args() set_logging_from_options(options) try: jobstore = Toil.getJobStore(options.jobStore) diff --git a/src/toil/utils/toilDebugFile.py b/src/toil/utils/toilDebugFile.py index 62145d8b17..05098f544f 100644 --- a/src/toil/utils/toilDebugFile.py +++ b/src/toil/utils/toilDebugFile.py @@ -15,6 +15,7 @@ import argparse import logging import os.path +import sys from typing import Optional from toil.common import Config, Toil, parser_with_common_options @@ -116,33 +117,33 @@ def main() -> None: if options.fetch: # Copy only the listed files locally - if not isinstance(jobStore, FileJobStore): + if isinstance(jobStore, FileJobStore): + logger.debug("Fetching local files: %s", options.fetch) + fetchJobStoreFiles(jobStore=jobStore, options=options) + else: logger.critical("Can only fetch by name or glob from file-based job stores") sys.exit(1) - logger.debug("Fetching local files: %s", options.fetch) - fetchJobStoreFiles(jobStore=jobStore, options=options) - elif options.fetchEntireJobStore: # Copy all jobStore files locally - if not isinstance(jobStore, FileJobStore): + if isinstance(jobStore, FileJobStore): + logger.debug("Fetching all local files.") + options.fetch = "*" + fetchJobStoreFiles(jobStore=jobStore, options=options) + else: logger.critical("Can only fetch by name or glob from file-based job stores") sys.exit(1) - logger.debug("Fetching all local files.") - options.fetch = "*" - fetchJobStoreFiles(jobStore=jobStore, options=options) - if options.listFilesInJobStore: # Log filenames and create a file containing these names in cwd - if not isinstance(jobStore, FileJobStore): + if isinstance(jobStore, FileJobStore): + printContentsOfJobStore(job_store=jobStore) + else: logger.critical("Can only list files from file-based job stores") sys.exit(1) - printContentsOfJobStore(job_store=jobStore) - # TODO: We can't actually do *anything* for non-file job stores. diff --git a/src/toil/utils/toilDebugJob.py b/src/toil/utils/toilDebugJob.py index 23dd3f1efe..960f6b4c99 100644 --- a/src/toil/utils/toilDebugJob.py +++ b/src/toil/utils/toilDebugJob.py @@ -15,6 +15,7 @@ import logging import pprint +import sys from toil.common import Config, Toil, parser_with_common_options from toil.jobStores.fileJobStore import FileJobStore diff --git a/src/toil/utils/toilDestroyCluster.py b/src/toil/utils/toilDestroyCluster.py index 4095e21cbf..7239084842 100644 --- a/src/toil/utils/toilDestroyCluster.py +++ b/src/toil/utils/toilDestroyCluster.py @@ -21,8 +21,8 @@ logger = logging.getLogger(__name__) def main() -> None: - parser = parser_with_common_options(provisioner_options=True, jobstore_option=False) - options = parser.parse_args(prog="toil destroy-cluster") + parser = parser_with_common_options(provisioner_options=True, jobstore_option=False, prog="toil destroy-cluster") + options = parser.parse_args() set_logging_from_options(options) logger.info('Destroying cluster %s', options.clusterName)