Skip to content

Commit

Permalink
Fixed typo errors (#326)
Browse files Browse the repository at this point in the history
This commit fixes several issues:
- Fixes several typos in the code
- Removes the unused `step` parameter in the `_get_timeout`
  method
- Renames the `inputs` parameter in the `_persist_token`
  method to `input_token_ids`
- Improves the command format in the logs when the
  color feature is enabled
  • Loading branch information
LanderOtto authored Dec 22, 2023
1 parent a52e749 commit dec9150
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
6 changes: 3 additions & 3 deletions streamflow/cwl/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ async def _save_additional_params(
},
}

def _get_timeout(self, job: Job, step: Step) -> int | None:
def _get_timeout(self, job: Job) -> int | None:
timeout = 0
if isinstance(self.time_limit, int):
timeout = self.time_limit
Expand All @@ -355,7 +355,7 @@ def _get_timeout(self, job: Job, step: Step) -> int | None:
)
if timeout and timeout < 0:
raise WorkflowDefinitionException(
f"Invalid time limit for step {step.name}: {timeout}. Time limit should be >= 0."
f"Invalid time limit for step {self.step.name}: {timeout}. Time limit should be >= 0."
)
elif timeout == 0:
return None
Expand Down Expand Up @@ -824,7 +824,7 @@ async def execute(self, job: Job) -> CWLCommandOutput:
else stdout
)
# Get timeout
timeout = self._get_timeout(job=job, step=self.step)
timeout = self._get_timeout(job=job)
# Execute remote command
start_time = time.time_ns()
result, exit_code = await connector.run(
Expand Down
2 changes: 1 addition & 1 deletion streamflow/deployment/connector/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def __init__(
def _configure_incluster_namespace(self):
if self.namespace is None:
if not os.path.isfile(SERVICE_NAMESPACE_FILENAME):
raise ConfigException("Service namespace file does not exists.")
raise ConfigException("Service namespace file does not exist.")

with open(SERVICE_NAMESPACE_FILENAME) as f:
self.namespace = f.read()
Expand Down
13 changes: 7 additions & 6 deletions streamflow/deployment/connector/queue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,13 @@ def __init__(
template_map=files_map,
)
self.maxConcurrentJobs: int = maxConcurrentJobs
if logger.isEnabledFor(logging.WARNING):
logger.warning(
"The `maxConcurrentJobs` parameter is set to the default value 1, which prevents "
"multiple jobs to be concurrently submitted to the queue manager. Consider raising "
"this value to improve performance."
)
if self.maxConcurrentJobs == 1:
if logger.isEnabledFor(logging.WARNING):
logger.warning(
"The `maxConcurrentJobs` parameter is set to the default value 1, which prevents "
"multiple jobs to be concurrently submitted to the queue manager. Consider raising "
"this value to improve performance."
)
self.pollingInterval: int = pollingInterval
self.scheduledJobs: MutableSequence[str] = []
self.jobsCache: cachetools.Cache = cachetools.TTLCache(
Expand Down
2 changes: 1 addition & 1 deletion streamflow/deployment/connector/schemas/kubernetes.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"items": {
"type": "string"
},
"description": "A list of yaml file to deploy. Files will be deployed in direct order and undeplyoed in reverse order"
"description": "A list of yaml file to deploy. Files will be deployed in direct order and undeployed in reverse order"
},
"debug": {
"type": "boolean",
Expand Down
4 changes: 2 additions & 2 deletions streamflow/deployment/connector/schemas/ssh.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"string",
"null"
],
"description": "Path to the SSH key needed to connect with Slurm environment"
"description": "Path to the SSH key needed to connect with the environment"
},
"sshKeyPassphraseFile": {
"type": [
Expand Down Expand Up @@ -133,7 +133,7 @@
},
"sshKey": {
"type": "string",
"description": "Path to the SSH key needed to connect with Slurm environment"
"description": "Path to the SSH key needed to connect with the environment"
},
"sshKeyPassphraseFile": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion streamflow/log_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def filter(self, record):

def highlight(self, msg):
msg = str(msg)
msg_tok = msg.split()
msg_tok = msg.split(" ")
for pattern, category in self.patterns.items():
if msg_tok[0] == pattern:
if category == 0:
Expand Down
4 changes: 2 additions & 2 deletions streamflow/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def __call__(self, _parser, namespace, values, option_string=None):
"--all",
"-a",
action="store_true",
help="If true, include all executions of the selected worwflow. "
help="If true, include all executions of the selected workflow. "
"If false, include just the last one. (default: false)",
)
prov_parser.add_argument(
Expand Down Expand Up @@ -168,7 +168,7 @@ def __call__(self, _parser, namespace, values, option_string=None):
"--all",
"-a",
action="store_true",
help="If true, include all executions of the selected worwflow. "
help="If true, include all executions of the selected workflow. "
"If false, include just the last one. (default: false)",
)
report_parser.add_argument(
Expand Down
4 changes: 2 additions & 2 deletions streamflow/workflow/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,10 @@ async def run(self):
)
# Propagate the connector in the output port
self.get_output_port().put(
await self.persist_token(
await self._persist_token(
token=Token(value=self.deployment_config.name),
port=self.get_output_port(),
inputs=_get_token_ids(inputs.values()),
input_token_ids=_get_token_ids(inputs.values()),
)
)
else:
Expand Down

0 comments on commit dec9150

Please sign in to comment.