Skip to content

Commit

Permalink
removed duplicate logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Acribbs committed Jan 17, 2025
1 parent 7893635 commit 901be3b
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions cgatcore/pipeline/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,29 @@ def collect_benchmark_data(self, statements, resource_usage=None):
class SlurmExecutor(BaseExecutor):
"""Executor for running jobs on Slurm cluster."""

def __init__(self, **kwargs):
super().__init__(**kwargs)
def __init__(self, config, job_name, default_partition="main"):
"""Initialize SLURM executor.
Args:
config (dict): Configuration dictionary.
job_name (str): Name of the job.
default_partition (str, optional): Default SLURM partition. Defaults to "main".
"""
self.config = config
self.job_name = job_name
self.default_partition = default_partition

# Setup logging with a single handler to avoid duplication
self.logger = logging.getLogger("cgatcore.pipeline")
self.logger.addFilter(LoggingFilterpipelineName("slurm"))
self.task_name = "slurm_task"
self.default_total_time = 10

# Remove any existing handlers to prevent duplication
if self.logger.hasHandlers():
self.logger.handlers.clear()

# Add a single handler with our custom filter
handler = logging.StreamHandler()
handler.addFilter(LoggingFilterpipelineName(job_name))
self.logger.addHandler(handler)

# Get default partition
self.get_default_partition()
Expand Down Expand Up @@ -349,8 +366,8 @@ def collect_benchmark_data(self, statements, resource_usage=None):
dict: Benchmark data including task name and execution time
"""
return {
"task": self.task_name,
"total_t": self.default_total_time,
"task": "slurm_task",
"total_t": 10,
"statements": statements,
"resource_usage": resource_usage or []
}
Expand Down

0 comments on commit 901be3b

Please sign in to comment.