Skip to content
Snippets Groups Projects
Commit 301a6a01 authored by Yoann Schneider's avatar Yoann Schneider :tennis:
Browse files

Merge branch 'chunks-cli-arg' into 'master'

Make chunks_number a CLI argument instead of a user configuration param

Closes #6

See merge request !5
parents 6e8a0075 376068e9
No related branches found
No related tags found
1 merge request!5Make chunks_number a CLI argument instead of a user configuration param
Pipeline #173740 passed
......@@ -9,11 +9,6 @@ workers:
build: Dockerfile
command: worker-init-elements
user_configuration:
chunks_number:
title: Number of chunks to split workflow into after initialisation
type: int
default: 1
required: true
use_cache:
title: Enable SQLite database generation for worker caching
type: bool
......
......@@ -67,12 +67,6 @@ def _mock_worker_run_api(mock_api_client: MockApiClient) -> None:
"description": None,
"configuration": {},
"user_configuration": {
"chunks_number": {
"type": "int",
"title": "Chunks number",
"default": 1,
"required": True,
},
"use_cache": {
"type": "bool",
"title": "Use cache",
......
......@@ -61,6 +61,14 @@ class ActivityState(Enum):
class InitElementsWorker(BaseWorker):
def add_arguments(self) -> None:
self.parser.add_argument(
"--chunks-number",
help="Number of chunks to split workflow into after initialisation",
type=int,
default=1,
)
def configure(self) -> None:
# CLI args are stored on the instance so that implementations can access them
self.args = self.parser.parse_args()
......@@ -75,7 +83,7 @@ class InitElementsWorker(BaseWorker):
self.config.update(self.user_configuration)
logger.info("User configuration retrieved")
self.chunks_number = self.config["chunks_number"]
self.chunks_number = self.args.chunks_number
self.use_cache = self.config["use_cache"]
self.api_client.sleep_duration = self.config["sleep"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment