From 45a5743b81514696a64a5c5c12817b3462722122 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 8 Mar 2024 07:55:57 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Bump=20version:=202.2.0=20=E2=86=92=202.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/sleeper/.cookiecutterrc | 2 +- services/sleeper/VERSION | 2 +- services/sleeper/metadata/metadata.yml | 2 +- services/sleeper/versioning/service.cfg | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/sleeper/.cookiecutterrc b/services/sleeper/.cookiecutterrc index d2060b91..d51d8fca 100644 --- a/services/sleeper/.cookiecutterrc +++ b/services/sleeper/.cookiecutterrc @@ -34,4 +34,4 @@ default_context: project_slug: "sleeper" project_type: "computational" release_date: "2020" - version: "2.2.0" + version: "2.2.1" diff --git a/services/sleeper/VERSION b/services/sleeper/VERSION index ccbccc3d..c043eea7 100644 --- a/services/sleeper/VERSION +++ b/services/sleeper/VERSION @@ -1 +1 @@ -2.2.0 +2.2.1 diff --git a/services/sleeper/metadata/metadata.yml b/services/sleeper/metadata/metadata.yml index b6144962..a536176e 100644 --- a/services/sleeper/metadata/metadata.yml +++ b/services/sleeper/metadata/metadata.yml @@ -1,6 +1,6 @@ type: computational integration-version: 1.0.0 -version: 2.2.0 +version: 2.2.1 description: A service which awaits for time to pass, two times. contact: maiz@itis.swiss authors: diff --git a/services/sleeper/versioning/service.cfg b/services/sleeper/versioning/service.cfg index e8bd7a4f..b32996f1 100644 --- a/services/sleeper/versioning/service.cfg +++ b/services/sleeper/versioning/service.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.2.0 +current_version = 2.2.1 commit = False message = service/kernel version: {current_version} → {new_version} tag = False From 29daf6dd41770f5f521cbb92aa2e910173a5498f Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 8 Mar 2024 07:57:57 +0100 Subject: [PATCH 2/4] the unit is byte --- services/sleeper/metadata/metadata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/sleeper/metadata/metadata.yml b/services/sleeper/metadata/metadata.yml index a536176e..060bd4d7 100644 --- a/services/sleeper/metadata/metadata.yml +++ b/services/sleeper/metadata/metadata.yml @@ -60,7 +60,7 @@ inputs: contentSchema: title: Dream of the night type: integer - x_unit: bytes + x_unit: byte minimum: 0 outputs: output_1: From cb96cc319b2e5ebea66b7008c8bf7ffc0d49b3b1 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 8 Mar 2024 07:58:08 +0100 Subject: [PATCH 3/4] singular --- services/sleeper/src/sleeper/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/sleeper/src/sleeper/main.py b/services/sleeper/src/sleeper/main.py index 9d9e1495..58133f96 100644 --- a/services/sleeper/src/sleeper/main.py +++ b/services/sleeper/src/sleeper/main.py @@ -73,13 +73,13 @@ def generate_random_words(word_length, total_length): return "".join(words) -def dream(output_folder: Path, dream_size_bytes: int) -> None: +def dream(output_folder: Path, dream_size_byte: int) -> None: output_3_file = output_folder / "dream.txt" with output_3_file.open("wb") as fp: - psychedelic_content = generate_random_words(6, dream_size_bytes).encode() + psychedelic_content = generate_random_words(6, dream_size_byte).encode() fp.write(psychedelic_content) - fp.truncate(dream_size_bytes) - print(f"What a dream! it was {dream_size_bytes}!! Amazing!") + fp.truncate(dream_size_byte) + print(f"What a dream! it was {dream_size_byte}!! Amazing!") def sleep_with_payload( @@ -118,7 +118,7 @@ def main() -> None: sleep_interval = int(get_from_environ("INPUT_2", get_random_sleep())) fail_after_sleep = cast_bool(get_from_environ("INPUT_3", "false")) walk_distance = int(get_from_environ("INPUT_4", 0)) - dream_size_bytes = int(get_from_environ("INPUT_5", 0)) + dream_size_byte = int(get_from_environ("INPUT_5", 0)) output_folder = Path(get_from_environ("OUTPUT_FOLDER")) # if the service needs to confirm GPU is working enforce_gpu_support = get_from_environ("DOCKER_RESOURCE_VRAM") is not None @@ -157,7 +157,7 @@ def main() -> None: output_json = output_folder / "outputs.json" output_json.write_text(json.dumps(output_json_content)) - dream(output_folder, dream_size_bytes) + dream(output_folder, dream_size_byte) # Last step should be to fail if fail_after_sleep: From b3eebf75626e302efc4c76c5344397c4b1066050 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 8 Mar 2024 07:58:43 +0100 Subject: [PATCH 4/4] updated byte unit --- services/sleeper/docker-compose-meta.yml | 12 ++++++------ services/sleeper/service.cli/run | 12 +++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/services/sleeper/docker-compose-meta.yml b/services/sleeper/docker-compose-meta.yml index 9d9096c3..3c3fd1ae 100644 --- a/services/sleeper/docker-compose-meta.yml +++ b/services/sleeper/docker-compose-meta.yml @@ -25,7 +25,7 @@ services: "meter"}}, "input_5": {"displayOrder": 5, "label": "Dream (or nightmare) of the night", "description": "Defines the size of the dream that will be generated [0:]", "defaultValue": 0, "type": "ref_contentSchema", "contentSchema": - {"title": "Dream of the night", "type": "integer", "x_unit": "bytes", "minimum": + {"title": "Dream of the night", "type": "integer", "x_unit": "byte", "minimum": 0}}}}' io.simcore.integration-version: '{"integration-version": "1.0.0"}' io.simcore.key: '{"key": "simcore/services/comp/itis/sleeper"}' @@ -40,7 +40,7 @@ services: "Contains some random data representing a dream", "type": "data:text/plain", "fileToKeyMap": {"dream.txt": "output_3"}}}}' io.simcore.type: '{"type": "computational"}' - io.simcore.version: '{"version": "2.2.0"}' + io.simcore.version: '{"version": "2.2.1"}' org.label-schema.build-date: ${BUILD_DATE} org.label-schema.schema-version: '1.0' org.label-schema.vcs-ref: ${VCS_REF} @@ -74,7 +74,7 @@ services: "meter"}}, "input_5": {"displayOrder": 5, "label": "Dream (or nightmare) of the night", "description": "Defines the size of the dream that will be generated [0:]", "defaultValue": 0, "type": "ref_contentSchema", "contentSchema": - {"title": "Dream of the night", "type": "integer", "x_unit": "bytes", "minimum": + {"title": "Dream of the night", "type": "integer", "x_unit": "byte", "minimum": 0}}}}' io.simcore.integration-version: '{"integration-version": "1.0.0"}' io.simcore.key: '{"key": "simcore/services/comp/itis/sleeper-gpu"}' @@ -89,7 +89,7 @@ services: "Contains some random data representing a dream", "type": "data:text/plain", "fileToKeyMap": {"dream.txt": "output_3"}}}}' io.simcore.type: '{"type": "computational"}' - io.simcore.version: '{"version": "2.2.0"}' + io.simcore.version: '{"version": "2.2.1"}' org.label-schema.build-date: ${BUILD_DATE} org.label-schema.schema-version: '1.0' org.label-schema.vcs-ref: ${VCS_REF} @@ -125,7 +125,7 @@ services: "meter"}}, "input_5": {"displayOrder": 5, "label": "Dream (or nightmare) of the night", "description": "Defines the size of the dream that will be generated [0:]", "defaultValue": 0, "type": "ref_contentSchema", "contentSchema": - {"title": "Dream of the night", "type": "integer", "x_unit": "bytes", "minimum": + {"title": "Dream of the night", "type": "integer", "x_unit": "byte", "minimum": 0}}}}' io.simcore.integration-version: '{"integration-version": "1.0.0"}' io.simcore.key: '{"key": "simcore/services/comp/itis/sleeper-mpi"}' @@ -140,7 +140,7 @@ services: "Contains some random data representing a dream", "type": "data:text/plain", "fileToKeyMap": {"dream.txt": "output_3"}}}}' io.simcore.type: '{"type": "computational"}' - io.simcore.version: '{"version": "2.2.0"}' + io.simcore.version: '{"version": "2.2.1"}' org.label-schema.build-date: ${BUILD_DATE} org.label-schema.schema-version: '1.0' org.label-schema.vcs-ref: ${VCS_REF} diff --git a/services/sleeper/service.cli/run b/services/sleeper/service.cli/run index de00b0fb..8314a617 100755 --- a/services/sleeper/service.cli/run +++ b/services/sleeper/service.cli/run @@ -1,3 +1,4 @@ + #!/bin/sh #--------------------------------------------------------------- # AUTO-GENERATED CODE, do not modify this will be overwritten!!! @@ -8,16 +9,17 @@ set -o nounset IFS=$(printf '\n\t') cd "$(dirname "$0")" json_input=$INPUT_FOLDER/inputs.json - + INPUT_1=$INPUT_FOLDER/single_number.txt export INPUT_1 -INPUT_2=$(jq <"$json_input" '.input_2') +INPUT_2=$(< "$json_input" jq '.input_2') export INPUT_2 -INPUT_3=$(jq <"$json_input" '.input_3') +INPUT_3=$(< "$json_input" jq '.input_3') export INPUT_3 -INPUT_4=$(jq <"$json_input" '.input_4') +INPUT_4=$(< "$json_input" jq '.input_4') export INPUT_4 -INPUT_5=$(jq <"$json_input" '.input_5') +INPUT_5=$(< "$json_input" jq '.input_5') export INPUT_5 exec execute.sh + \ No newline at end of file