Skip to content

Commit

Permalink
remove useless default threads and add default project
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Fulton-Howard authored and mbhall88 committed Apr 16, 2022
1 parent 34c3c4c commit fcc66ee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"default_threads": 1,
"default_cluster_logdir": "logs/cluster",
"default_queue": "",
"default_project": "",
"max_status_checks_per_second": 10,
"max_jobs_per_second": 10,
"profile_name": "lsf"
Expand Down
8 changes: 4 additions & 4 deletions {{cookiecutter.profile_name}}/CookieCutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ class CookieCutter:
Cookie Cutter wrapper
"""

@staticmethod
def get_default_threads() -> int:
return int("{{cookiecutter.default_threads}}")

@staticmethod
def get_default_mem_mb() -> int:
return int("{{cookiecutter.default_mem_mb}}")
Expand All @@ -19,6 +15,10 @@ def get_log_dir() -> str:
def get_default_queue() -> str:
return "{{cookiecutter.default_queue}}"

@staticmethod
def get_default_project() -> str:
return int("{{cookiecutter.default_project}}")

@staticmethod
def get_lsf_unit_for_limits() -> str:
return "{{cookiecutter.LSF_UNIT_FOR_LIMITS}}"
Expand Down
13 changes: 12 additions & 1 deletion {{cookiecutter.profile_name}}/lsf_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def cluster(self) -> dict:

@property
def threads(self) -> int:
return self.job_properties.get("threads", CookieCutter.get_default_threads())
return self.job_properties.get("threads", 1)

@property
def resources(self) -> dict:
Expand Down Expand Up @@ -175,6 +175,16 @@ def queue_cmd(self) -> str:
def rule_specific_params(self) -> str:
return self.lsf_config.params_for_rule(self.rule_name)

@property
def proj(self) -> str:
if re.match(r'-P ', self.rule_specific_params):
return ""
return self.cluster.get("project", CookieCutter.get_default_project())

@property
def proj_cmd(self) -> str:
return "-P {}".format(self.proj) if self.proj else ""

@property
def cluster_cmd(self) -> str:
return self._cluster_cmd
Expand All @@ -186,6 +196,7 @@ def submit_cmd(self) -> str:
self.resources_cmd,
self.jobinfo_cmd,
self.queue_cmd,
self.proj_cmd,
self.cluster_cmd,
self.rule_specific_params,
self.jobscript,
Expand Down

0 comments on commit fcc66ee

Please sign in to comment.