Skip to content

Commit 6748f5e

Browse files
authored
Add the created_at field to registered function objects 🎨 (#7797)
1 parent 169d99e commit 6748f5e

File tree

22 files changed

+1012
-814
lines changed

22 files changed

+1012
-814
lines changed

packages/models-library/src/models_library/functions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import datetime
12
from collections.abc import Mapping
23
from enum import Enum
34
from typing import Annotated, Any, Literal, TypeAlias
@@ -96,6 +97,7 @@ class FunctionBase(BaseModel):
9697

9798
class RegisteredFunctionBase(FunctionBase):
9899
uid: FunctionID
100+
created_at: datetime.datetime
99101

100102

101103
class ProjectFunction(FunctionBase):
@@ -152,6 +154,7 @@ class FunctionJobBase(BaseModel):
152154

153155
class RegisteredFunctionJobBase(FunctionJobBase):
154156
uid: FunctionJobID
157+
created_at: datetime.datetime
155158

156159

157160
class ProjectFunctionJob(FunctionJobBase):
@@ -207,6 +210,7 @@ class FunctionJobCollection(BaseModel):
207210

208211
class RegisteredFunctionJobCollection(FunctionJobCollection):
209212
uid: FunctionJobCollectionID
213+
created_at: datetime.datetime
210214

211215

212216
class FunctionJobCollectionStatus(BaseModel):
@@ -225,6 +229,7 @@ class FunctionJobDB(BaseModel):
225229

226230
class RegisteredFunctionJobDB(FunctionJobDB):
227231
uuid: FunctionJobID
232+
created: datetime.datetime
228233

229234

230235
class FunctionDB(BaseModel):
@@ -239,6 +244,7 @@ class FunctionDB(BaseModel):
239244

240245
class RegisteredFunctionDB(FunctionDB):
241246
uuid: FunctionID
247+
created: datetime.datetime
242248

243249

244250
class FunctionJobCollectionDB(BaseModel):
@@ -248,6 +254,7 @@ class FunctionJobCollectionDB(BaseModel):
248254

249255
class RegisteredFunctionJobCollectionDB(FunctionJobCollectionDB):
250256
uuid: FunctionJobCollectionID
257+
created: datetime.datetime
251258

252259

253260
class FunctionIDString(ConstrainedStr):

services/api-server/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.0
1+
0.9.0

services/api-server/openapi.json

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"info": {
44
"title": "osparc.io public API",
55
"description": "osparc-simcore public API specifications",
6-
"version": "0.8.0"
6+
"version": "0.9.0"
77
},
88
"paths": {
99
"/v0/meta": {
@@ -5286,7 +5286,7 @@
52865286
"function_jobs"
52875287
],
52885288
"summary": "List Function Jobs",
5289-
"description": "List function jobs\n\nNew in *version 0.8.0*",
5289+
"description": "List function jobs\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
52905290
"operationId": "list_function_jobs",
52915291
"security": [
52925292
{
@@ -5346,7 +5346,7 @@
53465346
"function_jobs"
53475347
],
53485348
"summary": "Register Function Job",
5349-
"description": "Create function job\n\nNew in *version 0.8.0*",
5349+
"description": "Create function job\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
53505350
"operationId": "register_function_job",
53515351
"security": [
53525352
{
@@ -5431,7 +5431,7 @@
54315431
"function_jobs"
54325432
],
54335433
"summary": "Get Function Job",
5434-
"description": "Get function job\n\nNew in *version 0.8.0*",
5434+
"description": "Get function job\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
54355435
"operationId": "get_function_job",
54365436
"security": [
54375437
{
@@ -6810,7 +6810,7 @@
68106810
"functions"
68116811
],
68126812
"summary": "Register Function",
6813-
"description": "Create function\n\nNew in *version 0.8.0*",
6813+
"description": "Create function\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
68146814
"operationId": "register_function",
68156815
"security": [
68166816
{
@@ -6903,7 +6903,7 @@
69036903
"functions"
69046904
],
69056905
"summary": "List Functions",
6906-
"description": "List functions\n\nNew in *version 0.8.0*",
6906+
"description": "List functions\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
69076907
"operationId": "list_functions",
69086908
"security": [
69096909
{
@@ -6965,7 +6965,7 @@
69656965
"functions"
69666966
],
69676967
"summary": "Get Function",
6968-
"description": "Get function\n\nNew in *version 0.8.0*",
6968+
"description": "Get function\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
69696969
"operationId": "get_function",
69706970
"security": [
69716971
{
@@ -7098,7 +7098,7 @@
70987098
"functions"
70997099
],
71007100
"summary": "List Function Jobs For Functionid",
7101-
"description": "List function jobs for a function\n\nNew in *version 0.8.0*",
7101+
"description": "List function jobs for a function\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
71027102
"operationId": "list_function_jobs_for_functionid",
71037103
"security": [
71047104
{
@@ -7170,7 +7170,7 @@
71707170
"functions"
71717171
],
71727172
"summary": "Update Function Title",
7173-
"description": "Update function\n\nNew in *version 0.8.0*",
7173+
"description": "Update function\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
71747174
"operationId": "update_function_title",
71757175
"security": [
71767176
{
@@ -7257,7 +7257,7 @@
72577257
"functions"
72587258
],
72597259
"summary": "Update Function Description",
7260-
"description": "Update function\n\nNew in *version 0.8.0*",
7260+
"description": "Update function\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
72617261
"operationId": "update_function_description",
72627262
"security": [
72637263
{
@@ -7568,7 +7568,7 @@
75687568
"functions"
75697569
],
75707570
"summary": "Run Function",
7571-
"description": "Run function\n\nNew in *version 0.8.0*",
7571+
"description": "Run function\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
75727572
"operationId": "run_function",
75737573
"security": [
75747574
{
@@ -7664,7 +7664,7 @@
76647664
"functions"
76657665
],
76667666
"summary": "Map Function",
7667-
"description": "Map function over input parameters\n\nNew in *version 0.8.0*",
7667+
"description": "Map function over input parameters\n\nNew in *version 0.8.0*\n\nAdded in *version 0.9.0*: add `created_at` field in the registered function-related objects",
76687668
"operationId": "map_function",
76697669
"security": [
76707670
{
@@ -10094,11 +10094,17 @@
1009410094
"type": "string",
1009510095
"format": "uuid",
1009610096
"title": "Uid"
10097+
},
10098+
"created_at": {
10099+
"type": "string",
10100+
"format": "date-time",
10101+
"title": "Created At"
1009710102
}
1009810103
},
1009910104
"type": "object",
1010010105
"required": [
10101-
"uid"
10106+
"uid",
10107+
"created_at"
1010210108
],
1010310109
"title": "RegisteredFunctionJobCollection"
1010410110
},
@@ -10164,6 +10170,11 @@
1016410170
"format": "uuid",
1016510171
"title": "Uid"
1016610172
},
10173+
"created_at": {
10174+
"type": "string",
10175+
"format": "date-time",
10176+
"title": "Created At"
10177+
},
1016710178
"project_id": {
1016810179
"type": "string",
1016910180
"format": "uuid",
@@ -10176,6 +10187,7 @@
1017610187
"output_schema",
1017710188
"default_inputs",
1017810189
"uid",
10190+
"created_at",
1017910191
"project_id"
1018010192
],
1018110193
"title": "RegisteredProjectFunction"
@@ -10230,6 +10242,11 @@
1023010242
"format": "uuid",
1023110243
"title": "Uid"
1023210244
},
10245+
"created_at": {
10246+
"type": "string",
10247+
"format": "date-time",
10248+
"title": "Created At"
10249+
},
1023310250
"project_job_id": {
1023410251
"type": "string",
1023510252
"format": "uuid",
@@ -10242,6 +10259,7 @@
1024210259
"inputs",
1024310260
"outputs",
1024410261
"uid",
10262+
"created_at",
1024510263
"project_job_id"
1024610264
],
1024710265
"title": "RegisteredProjectFunctionJob"
@@ -10308,6 +10326,11 @@
1030810326
"format": "uuid",
1030910327
"title": "Uid"
1031010328
},
10329+
"created_at": {
10330+
"type": "string",
10331+
"format": "date-time",
10332+
"title": "Created At"
10333+
},
1031110334
"code_url": {
1031210335
"type": "string",
1031310336
"title": "Code Url"
@@ -10319,6 +10342,7 @@
1031910342
"output_schema",
1032010343
"default_inputs",
1032110344
"uid",
10345+
"created_at",
1032210346
"code_url"
1032310347
],
1032410348
"title": "RegisteredPythonCodeFunction"
@@ -10372,14 +10396,20 @@
1037210396
"type": "string",
1037310397
"format": "uuid",
1037410398
"title": "Uid"
10399+
},
10400+
"created_at": {
10401+
"type": "string",
10402+
"format": "date-time",
10403+
"title": "Created At"
1037510404
}
1037610405
},
1037710406
"type": "object",
1037810407
"required": [
1037910408
"function_uid",
1038010409
"inputs",
1038110410
"outputs",
10382-
"uid"
10411+
"uid",
10412+
"created_at"
1038310413
],
1038410414
"title": "RegisteredPythonCodeFunctionJob"
1038510415
},
@@ -10445,6 +10475,11 @@
1044510475
"format": "uuid",
1044610476
"title": "Uid"
1044710477
},
10478+
"created_at": {
10479+
"type": "string",
10480+
"format": "date-time",
10481+
"title": "Created At"
10482+
},
1044810483
"solver_key": {
1044910484
"type": "string",
1045010485
"pattern": "^simcore/services/((comp|dynamic|frontend))/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
@@ -10462,6 +10497,7 @@
1046210497
"output_schema",
1046310498
"default_inputs",
1046410499
"uid",
10500+
"created_at",
1046510501
"solver_key",
1046610502
"solver_version"
1046710503
],
@@ -10517,6 +10553,11 @@
1051710553
"format": "uuid",
1051810554
"title": "Uid"
1051910555
},
10556+
"created_at": {
10557+
"type": "string",
10558+
"format": "date-time",
10559+
"title": "Created At"
10560+
},
1052010561
"solver_job_id": {
1052110562
"type": "string",
1052210563
"format": "uuid",
@@ -10529,6 +10570,7 @@
1052910570
"inputs",
1053010571
"outputs",
1053110572
"uid",
10573+
"created_at",
1053210574
"solver_job_id"
1053310575
],
1053410576
"title": "RegisteredSolverFunctionJob"

services/api-server/setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.8.0
2+
current_version = 0.9.0
33
commit = True
44
message = services/api-server version: {current_version} → {new_version}
55
tag = False
@@ -11,12 +11,12 @@ commit_args = --no-verify
1111
asyncio_mode = auto
1212
asyncio_default_fixture_loop_scope = function
1313
addopts = --strict-markers
14-
markers =
14+
markers =
1515
slow: marks tests as slow (deselect with '-m "not slow"')
1616
acceptance_test: "marks tests as 'acceptance tests' i.e. does the system do what the user expects? Typically those are workflows."
1717
testit: "marks test to run during development"
1818

1919
[mypy]
20-
plugins =
20+
plugins =
2121
pydantic.mypy
2222
sqlalchemy.ext.mypy.plugin

services/api-server/src/simcore_service_api_server/api/routes/function_job_collections_routes.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
)
2525
from ..dependencies.services import get_api_client
2626
from ..dependencies.webserver_rpc import get_wb_api_rpc_client
27-
from ._constants import FMSG_CHANGELOG_NEW_IN_VERSION, create_route_description
27+
from ._constants import (
28+
FMSG_CHANGELOG_ADDED_IN_VERSION,
29+
FMSG_CHANGELOG_NEW_IN_VERSION,
30+
create_route_description,
31+
)
2832
from .function_jobs_routes import function_job_status, get_function_job
2933

3034
# pylint: disable=too-many-arguments
@@ -41,6 +45,30 @@
4145
},
4246
}
4347

48+
ENDPOINTS = [
49+
"list_function_job_collections",
50+
"register_function_job_collection",
51+
"get_function_job_collection",
52+
"delete_function_job_collection",
53+
]
54+
CHANGE_LOGS = {}
55+
for endpoint in ENDPOINTS:
56+
CHANGE_LOGS[endpoint] = [
57+
FMSG_CHANGELOG_NEW_IN_VERSION.format("0.8.0"),
58+
]
59+
if endpoint in [
60+
"list_function_job_collections",
61+
"register_function_job_collection",
62+
"get_function_job_collection",
63+
"function_job_collection_list_function_jobs",
64+
]:
65+
CHANGE_LOGS[endpoint].append(
66+
FMSG_CHANGELOG_ADDED_IN_VERSION.format(
67+
"0.9.0",
68+
"add `created_at` field in the registered function-related objects",
69+
)
70+
)
71+
4472

4573
@function_job_collections_router.get(
4674
"",

0 commit comments

Comments
 (0)