forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨♻️ New fields for service metadata (ITISFoundation#5902)
- Loading branch information
Showing
39 changed files
with
317 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
validator, | ||
) | ||
|
||
from .basic_regex import VERSION_RE | ||
from .basic_regex import SEMANTIC_VERSION_RE_W_CAPTURE_GROUPS, VERSION_RE | ||
from .boot_options import BootOption, BootOptions | ||
from .emails import LowerCaseEmailStr | ||
from .services_constants import FILENAME_RE, PROPERTY_TYPE_RE | ||
|
@@ -480,25 +480,104 @@ def validate_thumbnail(cls, value): # pylint: disable=no-self-argument,no-self- | |
ServiceOutputsDict: TypeAlias = dict[ServicePortKey, ServiceOutput] | ||
|
||
|
||
_EXAMPLE = { | ||
"name": "oSparc Python Runner", | ||
"key": "simcore/services/comp/osparc-python-runner", | ||
"type": "computational", | ||
"integration-version": "1.0.0", | ||
"progress_regexp": "^(?:\\[?PROGRESS\\]?:?)?\\s*(?P<value>[0-1]?\\.\\d+|\\d+\\s*(?P<percent_sign>%))", | ||
"version": "1.7.0", | ||
"description": "oSparc Python Runner", | ||
"contact": "[email protected]", | ||
"authors": [ | ||
{ | ||
"name": "John Smith", | ||
"email": "[email protected]", | ||
"affiliation": "Company", | ||
}, | ||
{ | ||
"name": "Richard Brown", | ||
"email": "[email protected]", | ||
"affiliation": "University", | ||
}, | ||
], | ||
"inputs": { | ||
"input_1": { | ||
"displayOrder": 1, | ||
"label": "Input data", | ||
"description": "Any code, requirements or data file", | ||
"type": "data:*/*", | ||
} | ||
}, | ||
"outputs": { | ||
"output_1": { | ||
"displayOrder": 1, | ||
"label": "Output data", | ||
"description": "All data produced by the script is zipped as output_data.zip", | ||
"type": "data:*/*", | ||
"fileToKeyMap": {"output_data.zip": "output_1"}, | ||
} | ||
}, | ||
} | ||
|
||
_EXAMPLE_W_BOOT_OPTIONS_AND_NO_DISPLAY_ORDER = { | ||
**_EXAMPLE, | ||
"description": "oSparc Python Runner with boot options", | ||
"inputs": { | ||
"input_1": { | ||
"label": "Input data", | ||
"description": "Any code, requirements or data file", | ||
"type": "data:*/*", | ||
} | ||
}, | ||
"outputs": { | ||
"output_1": { | ||
"label": "Output data", | ||
"description": "All data produced by the script is zipped as output_data.zip", | ||
"type": "data:*/*", | ||
"fileToKeyMap": {"output_data.zip": "output_1"}, | ||
} | ||
}, | ||
"boot-options": { | ||
"example_service_defined_boot_mode": BootOption.Config.schema_extra["examples"][ | ||
0 | ||
], | ||
"example_service_defined_theme_selection": BootOption.Config.schema_extra[ | ||
"examples" | ||
][1], | ||
}, | ||
"min-visible-inputs": 2, | ||
} | ||
|
||
|
||
class ServiceDockerData(ServiceKeyVersion, _BaseServiceCommonDataModel): | ||
""" | ||
Static metadata for a service injected in the image labels | ||
This is one to one with node-meta-v0.0.1.json | ||
NOTE: This model is serialized in .osparc/metadata.yml and in the labels of the docker image | ||
""" | ||
|
||
integration_version: str | None = Field( | ||
version_display: str | None = Field( | ||
None, | ||
alias="integration-version", | ||
description="integration version number", | ||
regex=VERSION_RE, | ||
examples=["1.0.0"], | ||
description="A user-friendly or marketing name for the release." | ||
" This can be used to reference the release in a more readable and recognizable format, such as 'Matterhorn Release,' 'Spring Update,' or 'Holiday Edition.'" | ||
" This name is not used for version comparison but is useful for communication and documentation purposes.", | ||
) | ||
progress_regexp: str | None = Field( | ||
|
||
release_date: datetime | None = Field( | ||
None, | ||
alias="progress_regexp", | ||
description="regexp pattern for detecting computational service's progress", | ||
description="A timestamp when the specific version of the service was released." | ||
" This field helps in tracking the timeline of releases and understanding the sequence of updates." | ||
" A timestamp string should be formatted as YYYY-MM-DD[T]HH:MM[:SS[.ffffff]][Z or [±]HH[:]MM]", | ||
) | ||
|
||
integration_version: str | None = Field( | ||
None, | ||
alias="integration-version", | ||
description="This version is used to maintain backward compatibility when there are changes in the way a service is integrated into the framework", | ||
regex=SEMANTIC_VERSION_RE_W_CAPTURE_GROUPS, | ||
) | ||
|
||
service_type: ServiceType = Field( | ||
..., | ||
alias="type", | ||
|
@@ -526,6 +605,7 @@ class ServiceDockerData(ServiceKeyVersion, _BaseServiceCommonDataModel): | |
alias="boot-options", | ||
description="Service defined boot options. These get injected in the service as env variables.", | ||
) | ||
|
||
min_visible_inputs: NonNegativeInt | None = Field( | ||
None, | ||
alias="min-visible-inputs", | ||
|
@@ -535,108 +615,33 @@ class ServiceDockerData(ServiceKeyVersion, _BaseServiceCommonDataModel): | |
), | ||
) | ||
|
||
progress_regexp: str | None = Field( | ||
None, | ||
alias="progress_regexp", | ||
description="regexp pattern for detecting computational service's progress", | ||
) | ||
|
||
class Config: | ||
description = "Description of a simcore node 'class' with input and output" | ||
extra = Extra.forbid | ||
frozen = False # it inherits from ServiceKeyVersion. | ||
frozen = False # overrides config from ServiceKeyVersion. | ||
allow_population_by_field_name = True | ||
|
||
schema_extra: ClassVar[dict[str, Any]] = { | ||
"examples": [ | ||
{ | ||
"name": "oSparc Python Runner", | ||
"key": "simcore/services/comp/osparc-python-runner", | ||
"type": "computational", | ||
"integration-version": "1.0.0", | ||
"progress_regexp": "^(?:\\[?PROGRESS\\]?:?)?\\s*(?P<value>[0-1]?\\.\\d+|\\d+\\s*(?P<percent_sign>%))", | ||
"version": "1.7.0", | ||
"description": "oSparc Python Runner", | ||
"contact": "[email protected]", | ||
"authors": [ | ||
{ | ||
"name": "John Smith", | ||
"email": "[email protected]", | ||
"affiliation": "Company", | ||
}, | ||
{ | ||
"name": "Richard Brown", | ||
"email": "[email protected]", | ||
"affiliation": "University", | ||
}, | ||
], | ||
"inputs": { | ||
"input_1": { | ||
"displayOrder": 1, | ||
"label": "Input data", | ||
"description": "Any code, requirements or data file", | ||
"type": "data:*/*", | ||
} | ||
}, | ||
"outputs": { | ||
"output_1": { | ||
"displayOrder": 1, | ||
"label": "Output data", | ||
"description": "All data produced by the script is zipped as output_data.zip", | ||
"type": "data:*/*", | ||
"fileToKeyMap": {"output_data.zip": "output_1"}, | ||
} | ||
}, | ||
}, | ||
_EXAMPLE, | ||
_EXAMPLE_W_BOOT_OPTIONS_AND_NO_DISPLAY_ORDER, | ||
# latest | ||
{ | ||
"name": "oSparc Python Runner", | ||
"key": "simcore/services/comp/osparc-python-runner", | ||
"type": "computational", | ||
"integration-version": "1.0.0", | ||
"progress_regexp": "^(?:\\[?PROGRESS\\]?:?)?\\s*(?P<value>[0-1]?\\.\\d+|\\d+\\s*(?P<percent_sign>%))", | ||
"version": "1.7.0", | ||
"description": "oSparc Python Runner with boot options", | ||
"contact": "[email protected]", | ||
"authors": [ | ||
{ | ||
"name": "John Smith", | ||
"email": "[email protected]", | ||
"affiliation": "Company", | ||
}, | ||
{ | ||
"name": "Richard Brown", | ||
"email": "[email protected]", | ||
"affiliation": "University", | ||
}, | ||
], | ||
"inputs": { | ||
"input_1": { | ||
"label": "Input data", | ||
"description": "Any code, requirements or data file", | ||
"type": "data:*/*", | ||
} | ||
}, | ||
"outputs": { | ||
"output_1": { | ||
"label": "Output data", | ||
"description": "All data produced by the script is zipped as output_data.zip", | ||
"type": "data:*/*", | ||
"fileToKeyMap": {"output_data.zip": "output_1"}, | ||
} | ||
}, | ||
"boot-options": { | ||
"example_service_defined_boot_mode": BootOption.Config.schema_extra[ | ||
"examples" | ||
][ | ||
0 | ||
], | ||
"example_service_defined_theme_selection": BootOption.Config.schema_extra[ | ||
"examples" | ||
][ | ||
1 | ||
], | ||
}, | ||
"min-visible-inputs": 2, | ||
**_EXAMPLE_W_BOOT_OPTIONS_AND_NO_DISPLAY_ORDER, | ||
"version_display": "Matterhorn Release", | ||
"release_date": "2024-05-31T13:45:30", | ||
}, | ||
] | ||
} | ||
|
||
|
||
class ServiceMetaData(_BaseServiceCommonDataModel): | ||
class BaseServiceMetaData(_BaseServiceCommonDataModel): | ||
# Overrides all fields of _BaseServiceCommonDataModel: | ||
# - for a partial update all members must be Optional | ||
# FIXME: if API entry needs a schema to allow partial updates (e.g. patch/put), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.3 | ||
1.0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.