diff --git a/pysqa/cmd.py b/pysqa/cmd.py index 7aa7268..eabeb78 100644 --- a/pysqa/cmd.py +++ b/pysqa/cmd.py @@ -7,7 +7,9 @@ from pysqa.utils.execute import execute_command -def command_line(arguments_lst: list=None, execute_command: callable = execute_command): +def command_line( + arguments_lst: list = None, execute_command: callable = execute_command +): """ Parse the command line arguments. diff --git a/pysqa/executor/backend.py b/pysqa/executor/backend.py index 599dc8e..26ff104 100644 --- a/pysqa/executor/backend.py +++ b/pysqa/executor/backend.py @@ -10,7 +10,9 @@ ) -def execute_files_from_list(tasks_in_progress_dict: dict, cache_directory: str, executor): +def execute_files_from_list( + tasks_in_progress_dict: dict, cache_directory: str, executor +): file_lst = os.listdir(cache_directory) for file_name_in in file_lst: key = file_name_in.split(".in.pl")[0] @@ -58,7 +60,7 @@ def execute_tasks(cores: int, cache_directory: str): ) -def command_line(arguments_lst: list=None): +def command_line(arguments_lst: list = None): if arguments_lst is None: arguments_lst = sys.argv[1:] cores_arg = arguments_lst[arguments_lst.index("--cores") + 1] diff --git a/pysqa/executor/executor.py b/pysqa/executor/executor.py index a5a1245..b14b56e 100644 --- a/pysqa/executor/executor.py +++ b/pysqa/executor/executor.py @@ -12,7 +12,9 @@ class Executor(FutureExecutor): - def __init__(self, cwd: str=None, queue_adapter=None, queue_adapter_kwargs: dict=None): + def __init__( + self, cwd: str = None, queue_adapter=None, queue_adapter_kwargs: dict = None + ): self._task_queue = queue.Queue() self._memory_dict = {} self._cache_directory = os.path.abspath(os.path.expanduser(cwd)) diff --git a/pysqa/executor/helper.py b/pysqa/executor/helper.py index d99980d..1040520 100644 --- a/pysqa/executor/helper.py +++ b/pysqa/executor/helper.py @@ -38,7 +38,9 @@ def read_from_file(file_name: str) -> dict: return {name: f.read()} -def reload_previous_futures(future_queue: queue.Queue, future_dict: dict, cache_directory: str): +def reload_previous_futures( + future_queue: queue.Queue, future_dict: dict, cache_directory: str +): file_lst = os.listdir(cache_directory) for f in file_lst: if f.endswith(".in.pl"): diff --git a/pysqa/ext/modular.py b/pysqa/ext/modular.py index ce3a3f2..ade5ffb 100644 --- a/pysqa/ext/modular.py +++ b/pysqa/ext/modular.py @@ -8,7 +8,12 @@ class ModularQueueAdapter(BasisQueueAdapter): - def __init__(self, config: dict, directory: str = "~/.queues", execute_command: callable = execute_command): + def __init__( + self, + config: dict, + directory: str = "~/.queues", + execute_command: callable = execute_command, + ): super(ModularQueueAdapter, self).__init__( config=config, directory=directory, execute_command=execute_command ) diff --git a/pysqa/ext/remote.py b/pysqa/ext/remote.py index 8219dd1..3d2c3ec 100644 --- a/pysqa/ext/remote.py +++ b/pysqa/ext/remote.py @@ -15,7 +15,12 @@ class RemoteQueueAdapter(BasisQueueAdapter): - def __init__(self, config: dict, directory: str = "~/.queues", execute_command: callable = execute_command): + def __init__( + self, + config: dict, + directory: str = "~/.queues", + execute_command: callable = execute_command, + ): super(RemoteQueueAdapter, self).__init__( config=config, directory=directory, execute_command=execute_command ) @@ -191,7 +196,12 @@ def get_job_from_remote(self, working_directory: str): if self._ssh_delete_file_on_remote: self._execute_remote_command(command="rm -r " + remote_working_directory) - def transfer_file(self, file: str, transfer_back: bool = False, delete_file_on_remote: bool = False): + def transfer_file( + self, + file: str, + transfer_back: bool = False, + delete_file_on_remote: bool = False, + ): working_directory = os.path.abspath(os.path.expanduser(file)) remote_working_directory = self._get_remote_working_dir( working_directory=working_directory diff --git a/pysqa/queueadapter.py b/pysqa/queueadapter.py index e052c28..02f3478 100644 --- a/pysqa/queueadapter.py +++ b/pysqa/queueadapter.py @@ -45,7 +45,9 @@ class QueueAdapter(object): Queues available for auto completion QueueAdapter().queues. returns the queue name. """ - def __init__(self, directory: str = "~/.queues", execute_command: callable = execute_command): + def __init__( + self, directory: str = "~/.queues", execute_command: callable = execute_command + ): queue_yaml = os.path.join(directory, "queue.yaml") clusters_yaml = os.path.join(directory, "clusters.yaml") self._adapter = None @@ -202,7 +204,10 @@ def get_job_from_remote(self, working_directory: str): self._adapter.get_job_from_remote(working_directory=working_directory) def transfer_file_to_remote( - self, file: str, transfer_back: bool = False, delete_file_on_remote: bool = False + self, + file: str, + transfer_back: bool = False, + delete_file_on_remote: bool = False, ): """ Transfer file from remote host to local host @@ -240,7 +245,7 @@ def delete_job(self, process_id: int) -> str: """ return self._adapter.delete_job(process_id=process_id) - def get_queue_status(self, user: str=None) -> pandas.DataFrame: + def get_queue_status(self, user: str = None) -> pandas.DataFrame: """ Args: @@ -282,7 +287,12 @@ def get_status_of_jobs(self, process_id_lst: list[int]) -> list[str]: return self._adapter.get_status_of_jobs(process_id_lst=process_id_lst) def check_queue_parameters( - self, queue: str, cores: int = 1, run_time_max: int = None, memory_max: int = None, active_queue: dict = None + self, + queue: str, + cores: int = 1, + run_time_max: int = None, + memory_max: int = None, + active_queue: dict = None, ): """ @@ -305,7 +315,9 @@ def check_queue_parameters( ) -def set_queue_adapter(config: dict, directory: str, execute_command: callable=execute_command): +def set_queue_adapter( + config: dict, directory: str, execute_command: callable = execute_command +): """ Initialize the queue adapter diff --git a/pysqa/utils/basic.py b/pysqa/utils/basic.py index 5db323d..56c0cf5 100644 --- a/pysqa/utils/basic.py +++ b/pysqa/utils/basic.py @@ -44,7 +44,12 @@ class BasisQueueAdapter(object): Queues available for auto completion QueueAdapter().queues. returns the queue name. """ - def __init__(self, config: dict, directory: str = "~/.queues", execute_command: callable = execute_command): + def __init__( + self, + config: dict, + directory: str = "~/.queues", + execute_command: callable = execute_command, + ): self._config = config self._fill_queue_dict(queue_lst_dict=self._config["queues"]) self._load_templates(queue_lst_dict=self._config["queues"], directory=directory) @@ -182,7 +187,9 @@ def submit_job( else: return None - def _list_command_to_be_executed(self, dependency_list: list[str], queue_script_path: str) -> list: + def _list_command_to_be_executed( + self, dependency_list: list[str], queue_script_path: str + ) -> list: return ( self._commands.submit_job_command + self._commands.dependencies(dependency_list) @@ -295,11 +302,21 @@ def get_job_from_remote(self, working_directory: str): def convert_path_to_remote(self, path: str): raise NotImplementedError - def transfer_file(self, file: str, transfer_back: bool = False, delete_file_on_remote: bool = False): + def transfer_file( + self, + file: str, + transfer_back: bool = False, + delete_file_on_remote: bool = False, + ): raise NotImplementedError def check_queue_parameters( - self, queue: str, cores: int = 1, run_time_max: int = None, memory_max: int = None, active_queue: dict = None + self, + queue: str, + cores: int = 1, + run_time_max: int = None, + memory_max: int = None, + active_queue: dict = None, ) -> list: """