Skip to content

Commit

Permalink
Add option for loading a lighter client with config_only
Browse files Browse the repository at this point in the history
  • Loading branch information
TorecLuik committed Dec 16, 2024
1 parent e1494ed commit d2704ee
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions biomero/slurm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ def __init__(self,
enable_job_accounting: bool = True,
enable_job_progress: bool = True,
enable_workflow_analytics: bool = True,
sqlalchemy_url: str = None):
sqlalchemy_url: str = None,
config_only: bool = False):
"""
Initializes a new instance of the SlurmClient class.
Expand Down Expand Up @@ -424,18 +425,22 @@ def __init__(self,
self.get_or_create_github_session()

self.init_workflows()
self.validate(validate_slurm_setup=init_slurm)

# Setup workflow tracking and accounting
# Initialize the analytics settings
self.track_workflows = track_workflows
self.enable_job_accounting = enable_job_accounting
self.enable_job_progress = enable_job_progress
self.enable_workflow_analytics = enable_workflow_analytics
if not config_only:
self.validate(validate_slurm_setup=init_slurm)

# Initialize the analytics system
self.sqlalchemy_url = sqlalchemy_url
self.initialize_analytics_system(reset_tables=init_slurm)
# Setup workflow tracking and accounting
# Initialize the analytics settings
self.track_workflows = track_workflows
self.enable_job_accounting = enable_job_accounting
self.enable_job_progress = enable_job_progress
self.enable_workflow_analytics = enable_workflow_analytics

# Initialize the analytics system
self.sqlalchemy_url = sqlalchemy_url
self.initialize_analytics_system(reset_tables=init_slurm)
else:
logger.warning("Setup SlurmClient for config only")

def initialize_analytics_system(self, reset_tables=False):
"""
Expand Down Expand Up @@ -858,7 +863,8 @@ def setup_directories(self):

@classmethod
def from_config(cls, configfile: str = '',
init_slurm: bool = False) -> 'SlurmClient':
init_slurm: bool = False,
config_only: bool = False) -> 'SlurmClient':
"""Creates a new SlurmClient object using the parameters read from a
configuration file (.ini).
Expand Down Expand Up @@ -978,7 +984,8 @@ def from_config(cls, configfile: str = '',
enable_job_accounting=enable_job_accounting,
enable_job_progress=enable_job_progress,
enable_workflow_analytics=enable_workflow_analytics,
sqlalchemy_url=sqlalchemy_url)
sqlalchemy_url=sqlalchemy_url,
config_only=config_only)

def cleanup_tmp_files(self,
slurm_job_id: str,
Expand Down

0 comments on commit d2704ee

Please sign in to comment.