From f9a7d5ff56fd5049147811a255cf4a34fa61dc1e Mon Sep 17 00:00:00 2001 From: Andres Tanasijczuk Date: Wed, 2 Jun 2021 17:45:58 +0200 Subject: [PATCH] Fix python3 issues --- lib/SlurmDagman/__init__.py | 2 +- lib/SlurmDagman/config/manager.py | 2 +- lib/SlurmDagman/dag/__init__.py | 4 ++-- lib/SlurmDagman/process/worker.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/SlurmDagman/__init__.py b/lib/SlurmDagman/__init__.py index 25906e6..d293bfc 100644 --- a/lib/SlurmDagman/__init__.py +++ b/lib/SlurmDagman/__init__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python -__version__ = "0.1.2" +__version__ = "0.1.3" diff --git a/lib/SlurmDagman/config/manager.py b/lib/SlurmDagman/config/manager.py index 5adbd5d..65d6f87 100644 --- a/lib/SlurmDagman/config/manager.py +++ b/lib/SlurmDagman/config/manager.py @@ -50,7 +50,7 @@ def set_params(self, params): def set_param(self, section, option, value): if not self.config.has_section(section): self.config.add_section(section) - self.config.set(section, option, value) + self.config.set(section, option, str(value)) def get_params(self, sections_and_options=None): diff --git a/lib/SlurmDagman/dag/__init__.py b/lib/SlurmDagman/dag/__init__.py index 6925a04..928b4f0 100644 --- a/lib/SlurmDagman/dag/__init__.py +++ b/lib/SlurmDagman/dag/__init__.py @@ -55,7 +55,7 @@ def reset_node(self, node): def get_nodes(self): - return self.dag.keys() + return list(self.dag.keys()) def parse(self): @@ -205,7 +205,7 @@ def write(self, dag_file='', use_dag_nodes_appearance_order=False, add_done_labe if use_dag_nodes_appearance_order and self.dag_nodes_appearance_order: nodes = sorted(self.dag_nodes_appearance_order, key=self.dag_nodes_appearance_order.get) else: - nodes = self.dag.keys() + nodes = self.get_nodes() jobs_lines = [] for node in nodes: job_line = 'JOB %s %s' % (node, self.dag[node]['job_submission_file']) diff --git a/lib/SlurmDagman/process/worker.py b/lib/SlurmDagman/process/worker.py index e42654b..fa00b5e 100644 --- a/lib/SlurmDagman/process/worker.py +++ b/lib/SlurmDagman/process/worker.py @@ -194,7 +194,7 @@ def __parse_process_config(self, log_changes=True): # type.) In case of such a failure, we get None for that parameter; # so we have to handle the case of a parameter being None. Finally, # we will return True if there is no None parameter and False otherwise. - params = self.__get_process_config_params().values() + params = list(self.__get_process_config_params().values()) sleep_time, max_jobs_queued, max_jobs_submit, submit_wait_time, \ drain, cancel \ = params[:] @@ -270,7 +270,7 @@ def __pre_execute_dag(self): def __pre_write_dag(self): - for node in copy.copy(self.dag_done.keys()): + for node in list(self.dag_done.keys()): if node not in self.dag: self.dag[node] = copy.deepcopy(self.dag_done[node]) else: