Skip to content

Commit

Permalink
Sleeper: version 2.2.1 (#156)
Browse files Browse the repository at this point in the history
* Bump version: 2.2.0 → 2.2.1

* the unit is byte
  • Loading branch information
sanderegg authored Mar 8, 2024
1 parent 4622407 commit 506a1cd
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion services/sleeper/.cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ default_context:
project_slug: "sleeper"
project_type: "computational"
release_date: "2020"
version: "2.2.0"
version: "2.2.1"
2 changes: 1 addition & 1 deletion services/sleeper/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0
2.2.1
12 changes: 6 additions & 6 deletions services/sleeper/docker-compose-meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}'
Expand All @@ -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}
Expand Down Expand Up @@ -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"}'
Expand All @@ -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}
Expand Down Expand Up @@ -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"}'
Expand All @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions services/sleeper/metadata/metadata.yml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
authors:
Expand Down Expand Up @@ -60,7 +60,7 @@ inputs:
contentSchema:
title: Dream of the night
type: integer
x_unit: bytes
x_unit: byte
minimum: 0
outputs:
output_1:
Expand Down
12 changes: 7 additions & 5 deletions services/sleeper/service.cli/run
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#!/bin/sh
#---------------------------------------------------------------
# AUTO-GENERATED CODE, do not modify this will be overwritten!!!
Expand All @@ -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

12 changes: 6 additions & 6 deletions services/sleeper/src/sleeper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion services/sleeper/versioning/service.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 506a1cd

Please sign in to comment.