Skip to content

Commit

Permalink
Satisfy MyPy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnovak committed Dec 7, 2023
1 parent 3ccad97 commit 13ce009
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/toil/jobStores/fileJobStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/toil/utils/toilClean.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 13 additions & 12 deletions src/toil/utils/toilDebugFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.


Expand Down
1 change: 1 addition & 0 deletions src/toil/utils/toilDebugJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/toil/utils/toilDestroyCluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 13ce009

Please sign in to comment.