superb-ai-onprem 0.1.6__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of superb-ai-onprem might be problematic. Click here for more details.
- spb_onprem/__init__.py +18 -2
- spb_onprem/_version.py +2 -2
- spb_onprem/activities/__init__.py +0 -0
- spb_onprem/activities/entities/__init__.py +10 -0
- spb_onprem/activities/entities/activity.py +39 -0
- spb_onprem/activities/entities/activity_history.py +31 -0
- spb_onprem/activities/params/__init__.py +23 -0
- spb_onprem/activities/params/activities.py +53 -0
- spb_onprem/activities/params/activity.py +42 -0
- spb_onprem/activities/params/create_activity.py +80 -0
- spb_onprem/activities/params/delete_activity.py +23 -0
- spb_onprem/activities/params/start_activity.py +59 -0
- spb_onprem/activities/params/update_activity.py +79 -0
- spb_onprem/activities/params/update_activity_history.py +54 -0
- spb_onprem/activities/queries.py +226 -0
- spb_onprem/activities/service.py +315 -0
- spb_onprem/base_model.py +2 -3
- spb_onprem/entities.py +12 -0
- spb_onprem/searches.py +6 -0
- spb_onprem/slices/params/slices.py +1 -1
- {superb_ai_onprem-0.1.6.dist-info → superb_ai_onprem-0.2.0.dist-info}/METADATA +1 -1
- {superb_ai_onprem-0.1.6.dist-info → superb_ai_onprem-0.2.0.dist-info}/RECORD +30 -11
- {superb_ai_onprem-0.1.6.dist-info → superb_ai_onprem-0.2.0.dist-info}/top_level.txt +1 -0
- tests/__init__.py +1 -0
- tests/activities/__init__.py +1 -0
- tests/activities/real_test.py +66 -0
- tests/activities/test_params.py +67 -0
- tests/activities/test_service.py +139 -0
- {superb_ai_onprem-0.1.6.dist-info → superb_ai_onprem-0.2.0.dist-info}/WHEEL +0 -0
- {superb_ai_onprem-0.1.6.dist-info → superb_ai_onprem-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
from spb_onprem.activities.params import (
|
|
2
|
+
get_activities_params,
|
|
3
|
+
get_activity_params,
|
|
4
|
+
|
|
5
|
+
create_activity_params,
|
|
6
|
+
update_activity_params,
|
|
7
|
+
delete_activity_params,
|
|
8
|
+
|
|
9
|
+
start_activity_params,
|
|
10
|
+
update_activity_history_params,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
class Schemas:
|
|
14
|
+
"""Schemas for activities queries
|
|
15
|
+
"""
|
|
16
|
+
ACTIVITY = '''
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
description
|
|
20
|
+
type
|
|
21
|
+
datasetId
|
|
22
|
+
progressSchema {
|
|
23
|
+
key
|
|
24
|
+
type
|
|
25
|
+
required
|
|
26
|
+
default
|
|
27
|
+
}
|
|
28
|
+
parameterSchema {
|
|
29
|
+
key
|
|
30
|
+
type
|
|
31
|
+
required
|
|
32
|
+
default
|
|
33
|
+
}
|
|
34
|
+
settings
|
|
35
|
+
meta
|
|
36
|
+
createdAt
|
|
37
|
+
createdBy
|
|
38
|
+
updatedAt
|
|
39
|
+
updatedBy
|
|
40
|
+
'''
|
|
41
|
+
ACTIVITY_HISTORY = '''
|
|
42
|
+
id
|
|
43
|
+
jobId
|
|
44
|
+
status
|
|
45
|
+
datasetId
|
|
46
|
+
parameters
|
|
47
|
+
progress
|
|
48
|
+
createdAt
|
|
49
|
+
createdBy
|
|
50
|
+
updatedAt
|
|
51
|
+
updatedBy
|
|
52
|
+
meta
|
|
53
|
+
'''
|
|
54
|
+
|
|
55
|
+
ACTIVITY_PAGE = f'''
|
|
56
|
+
jobs {{
|
|
57
|
+
{ACTIVITY}
|
|
58
|
+
}}
|
|
59
|
+
next
|
|
60
|
+
totalCount
|
|
61
|
+
'''
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class Queries:
|
|
65
|
+
'''
|
|
66
|
+
Queries for activities
|
|
67
|
+
'''
|
|
68
|
+
|
|
69
|
+
GET_ACTIVITIES = {
|
|
70
|
+
"name": "jobs",
|
|
71
|
+
"query": f'''
|
|
72
|
+
query jobs(
|
|
73
|
+
$filter: JobFilter,
|
|
74
|
+
$cursor: String,
|
|
75
|
+
$length: Int
|
|
76
|
+
$orderBy: JobOrderBy
|
|
77
|
+
) {{
|
|
78
|
+
jobs(
|
|
79
|
+
filter: $filter,
|
|
80
|
+
cursor: $cursor,
|
|
81
|
+
length: $length,
|
|
82
|
+
orderBy: $orderBy
|
|
83
|
+
) {{
|
|
84
|
+
{Schemas.ACTIVITY_PAGE}
|
|
85
|
+
}}
|
|
86
|
+
}}
|
|
87
|
+
''',
|
|
88
|
+
"variables": get_activities_params,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
GET_ACTIVITY = {
|
|
92
|
+
"name": "job",
|
|
93
|
+
"query": f'''
|
|
94
|
+
query job(
|
|
95
|
+
$name: String,
|
|
96
|
+
$id: ID
|
|
97
|
+
) {{
|
|
98
|
+
job(name: $name, id: $id) {{
|
|
99
|
+
{Schemas.ACTIVITY}
|
|
100
|
+
}}
|
|
101
|
+
}}
|
|
102
|
+
''',
|
|
103
|
+
"variables": get_activity_params,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
CREATE_ACTIVITY = {
|
|
107
|
+
"name": "createJob",
|
|
108
|
+
"query": f'''
|
|
109
|
+
mutation createJob(
|
|
110
|
+
$datasetId: ID,
|
|
111
|
+
$type: String!,
|
|
112
|
+
$name: String!,
|
|
113
|
+
$description: String,
|
|
114
|
+
|
|
115
|
+
$progressSchema: [JobProgressSchemaInput!],
|
|
116
|
+
$parameterSchema: [JobParameterSchemaInput!],
|
|
117
|
+
$settings: JSONObject,
|
|
118
|
+
$meta: JSONObject
|
|
119
|
+
) {{
|
|
120
|
+
createJob(
|
|
121
|
+
datasetId: $datasetId,
|
|
122
|
+
type: $type,
|
|
123
|
+
name: $name,
|
|
124
|
+
description: $description,
|
|
125
|
+
progressSchema: $progressSchema,
|
|
126
|
+
parameterSchema: $parameterSchema,
|
|
127
|
+
settings: $settings,
|
|
128
|
+
meta: $meta
|
|
129
|
+
) {{
|
|
130
|
+
{Schemas.ACTIVITY}
|
|
131
|
+
}}
|
|
132
|
+
}}
|
|
133
|
+
''',
|
|
134
|
+
"variables": create_activity_params,
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
UPDATE_ACTIVITY = {
|
|
138
|
+
"name": "updateJob",
|
|
139
|
+
"query": f'''
|
|
140
|
+
mutation updateJob(
|
|
141
|
+
$id: ID!,
|
|
142
|
+
$type: String,
|
|
143
|
+
$name: String,
|
|
144
|
+
$description: String,
|
|
145
|
+
$progressSchema: [JobProgressSchemaInput!],
|
|
146
|
+
$parameterSchema: [JobParameterSchemaInput!],
|
|
147
|
+
$settings: JSONObject,
|
|
148
|
+
$meta: JSONObject
|
|
149
|
+
) {{
|
|
150
|
+
updateJob(
|
|
151
|
+
id: $id,
|
|
152
|
+
type: $type,
|
|
153
|
+
name: $name,
|
|
154
|
+
description: $description,
|
|
155
|
+
progressSchema: $progressSchema,
|
|
156
|
+
parameterSchema: $parameterSchema,
|
|
157
|
+
settings: $settings,
|
|
158
|
+
meta: $meta
|
|
159
|
+
) {{
|
|
160
|
+
{Schemas.ACTIVITY}
|
|
161
|
+
}}
|
|
162
|
+
}}
|
|
163
|
+
''',
|
|
164
|
+
"variables": update_activity_params,
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
DELETE_ACTIVITY = {
|
|
168
|
+
"name": "deleteJob",
|
|
169
|
+
"query": '''
|
|
170
|
+
mutation deleteJob(
|
|
171
|
+
$id: ID!
|
|
172
|
+
) {
|
|
173
|
+
deleteJob(id: $id)
|
|
174
|
+
}
|
|
175
|
+
''',
|
|
176
|
+
"variables": delete_activity_params,
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
START_ACTIVITY = {
|
|
180
|
+
"name": "startJob",
|
|
181
|
+
"query": f'''
|
|
182
|
+
mutation startJob(
|
|
183
|
+
$id: ID,
|
|
184
|
+
$jobType: String,
|
|
185
|
+
|
|
186
|
+
$datasetId: ID,
|
|
187
|
+
$parameters: JSONObject,
|
|
188
|
+
$progress: JSONObject,
|
|
189
|
+
$meta: JSONObject
|
|
190
|
+
) {{
|
|
191
|
+
startJob(
|
|
192
|
+
id: $id,
|
|
193
|
+
jobType: $jobType,
|
|
194
|
+
datasetId: $datasetId,
|
|
195
|
+
parameters: $parameters,
|
|
196
|
+
progress: $progress,
|
|
197
|
+
meta: $meta
|
|
198
|
+
) {{
|
|
199
|
+
{Schemas.ACTIVITY_HISTORY}
|
|
200
|
+
}}
|
|
201
|
+
}}
|
|
202
|
+
''',
|
|
203
|
+
"variables": start_activity_params,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
UPDATE_ACTIVITY_HISTORY = {
|
|
207
|
+
"name": "updateJobHistory",
|
|
208
|
+
"query": f'''
|
|
209
|
+
mutation updateJobHistory(
|
|
210
|
+
$id: ID!,
|
|
211
|
+
$status: JobStatus,
|
|
212
|
+
$progress: JSONObject,
|
|
213
|
+
$meta: JSONObject
|
|
214
|
+
) {{
|
|
215
|
+
updateJobHistory(
|
|
216
|
+
id: $id,
|
|
217
|
+
status: $status,
|
|
218
|
+
progress: $progress,
|
|
219
|
+
meta: $meta
|
|
220
|
+
) {{
|
|
221
|
+
{Schemas.ACTIVITY_HISTORY}
|
|
222
|
+
}}
|
|
223
|
+
}}
|
|
224
|
+
''',
|
|
225
|
+
"variables": update_activity_history_params,
|
|
226
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
from typing import Optional, Union, List
|
|
2
|
+
|
|
3
|
+
from spb_onprem.base_service import BaseService
|
|
4
|
+
from spb_onprem.base_types import (
|
|
5
|
+
Undefined,
|
|
6
|
+
UndefinedType,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from .entities import (
|
|
10
|
+
Activity,
|
|
11
|
+
ActivitySchema,
|
|
12
|
+
ActivityHistory,
|
|
13
|
+
ActivityStatus,
|
|
14
|
+
)
|
|
15
|
+
from .params import (
|
|
16
|
+
ActivitiesFilter,
|
|
17
|
+
)
|
|
18
|
+
from .queries import (
|
|
19
|
+
Queries,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ActivityService(BaseService):
|
|
24
|
+
"""Service class for handling activity-related operations."""
|
|
25
|
+
|
|
26
|
+
def create_activity(
|
|
27
|
+
self,
|
|
28
|
+
activity_type: str,
|
|
29
|
+
name: str,
|
|
30
|
+
dataset_id: Union[
|
|
31
|
+
UndefinedType,
|
|
32
|
+
str
|
|
33
|
+
] = Undefined,
|
|
34
|
+
description: Union[
|
|
35
|
+
UndefinedType,
|
|
36
|
+
str
|
|
37
|
+
] = Undefined,
|
|
38
|
+
progress_schema: Optional[List[ActivitySchema]] = None,
|
|
39
|
+
parameter_schema: Optional[List[ActivitySchema]] = None,
|
|
40
|
+
settings: Optional[dict] = None,
|
|
41
|
+
meta: Optional[dict] = None,
|
|
42
|
+
) -> Activity:
|
|
43
|
+
"""Create an activity.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
activity_type (str): The type of the activity to create.
|
|
47
|
+
name (str): The name of the activity to create.
|
|
48
|
+
dataset_id (Optional[str]): The ID of the dataset to create the activity for.
|
|
49
|
+
description (Optional[str]): The description of the activity to create.
|
|
50
|
+
progress_schema (Optional[List[ActivitySchema]]): The progress schema of the activity to create.
|
|
51
|
+
parameter_schema (Optional[List[ActivitySchema]]): The parameter schema of the activity to create.
|
|
52
|
+
settings (Optional[dict]): The settings of the activity to create.
|
|
53
|
+
meta (Optional[dict]): The meta of the activity to create.
|
|
54
|
+
"""
|
|
55
|
+
response = self.request_gql(
|
|
56
|
+
Queries.CREATE_ACTIVITY,
|
|
57
|
+
Queries.CREATE_ACTIVITY["variables"](
|
|
58
|
+
activity_type=activity_type,
|
|
59
|
+
name=name,
|
|
60
|
+
dataset_id=dataset_id,
|
|
61
|
+
description=description,
|
|
62
|
+
progress_schema=progress_schema,
|
|
63
|
+
parameter_schema=parameter_schema,
|
|
64
|
+
settings=settings,
|
|
65
|
+
meta=meta,
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
activity_dict = response
|
|
69
|
+
return Activity.model_validate(activity_dict)
|
|
70
|
+
|
|
71
|
+
def get_activities(
|
|
72
|
+
self,
|
|
73
|
+
dataset_id: Optional[str] = None,
|
|
74
|
+
activity_filter: Optional[ActivitiesFilter] = None,
|
|
75
|
+
cursor: Optional[str] = None,
|
|
76
|
+
length: int = 10
|
|
77
|
+
) -> tuple[List[Activity], Optional[str], int]:
|
|
78
|
+
"""Get activities.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
dataset_id (str): The ID of the dataset to get activities for.
|
|
82
|
+
activity_filter (Optional[ActivitiesFilter]): The filter to apply to the activities.
|
|
83
|
+
cursor (Optional[str]): The cursor to use for pagination.
|
|
84
|
+
length (int): The number of activities to get.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
tuple[List[Activity], Optional[str], int]: A tuple containing the activities, the next cursor, and the total count of activities.
|
|
88
|
+
"""
|
|
89
|
+
response = self.request_gql(
|
|
90
|
+
Queries.GET_ACTIVITIES,
|
|
91
|
+
Queries.GET_ACTIVITIES["variables"](
|
|
92
|
+
dataset_id=dataset_id,
|
|
93
|
+
activity_filter=activity_filter,
|
|
94
|
+
cursor=cursor,
|
|
95
|
+
length=length,
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
activities_dict = response.get("jobs", [])
|
|
99
|
+
return (
|
|
100
|
+
[Activity.model_validate(activity_dict) for activity_dict in activities_dict],
|
|
101
|
+
response.get("next"),
|
|
102
|
+
response.get("totalCount"),
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
def get_activity(
|
|
106
|
+
self,
|
|
107
|
+
activity_id: Optional[str] = None,
|
|
108
|
+
activity_name: Optional[str] = None,
|
|
109
|
+
dataset_id: Optional[str] = None,
|
|
110
|
+
) -> Activity:
|
|
111
|
+
"""Get an activity.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
activity_id (str): The ID of the activity to get.
|
|
115
|
+
dataset_id (Optional[str]): The ID of the dataset to get the activity for.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Activity: The activity object.
|
|
119
|
+
"""
|
|
120
|
+
response = self.request_gql(
|
|
121
|
+
Queries.GET_ACTIVITY,
|
|
122
|
+
Queries.GET_ACTIVITY["variables"](
|
|
123
|
+
activity_id=activity_id,
|
|
124
|
+
activity_name=activity_name,
|
|
125
|
+
dataset_id=dataset_id,
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
return Activity.model_validate(response)
|
|
129
|
+
|
|
130
|
+
def update_activity(
|
|
131
|
+
self,
|
|
132
|
+
activity_id: str,
|
|
133
|
+
activity_type: Union[
|
|
134
|
+
str,
|
|
135
|
+
UndefinedType
|
|
136
|
+
] = Undefined,
|
|
137
|
+
name: Union[
|
|
138
|
+
str,
|
|
139
|
+
UndefinedType
|
|
140
|
+
] = Undefined,
|
|
141
|
+
dataset_id: Union[
|
|
142
|
+
UndefinedType,
|
|
143
|
+
str
|
|
144
|
+
] = Undefined,
|
|
145
|
+
description: Union[
|
|
146
|
+
UndefinedType,
|
|
147
|
+
str
|
|
148
|
+
] = Undefined,
|
|
149
|
+
progress_schema: Union[
|
|
150
|
+
UndefinedType,
|
|
151
|
+
List[ActivitySchema]
|
|
152
|
+
] = Undefined,
|
|
153
|
+
parameter_schema: Union[
|
|
154
|
+
UndefinedType,
|
|
155
|
+
List[ActivitySchema]
|
|
156
|
+
] = Undefined,
|
|
157
|
+
settings: Union[
|
|
158
|
+
UndefinedType,
|
|
159
|
+
dict
|
|
160
|
+
] = Undefined,
|
|
161
|
+
meta: Union[
|
|
162
|
+
UndefinedType,
|
|
163
|
+
dict
|
|
164
|
+
] = Undefined,
|
|
165
|
+
) -> Activity:
|
|
166
|
+
"""Update an activity.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
activity_id (str): The ID of the activity to update.
|
|
170
|
+
activity_type (Optional[str]): The type of the activity to update.
|
|
171
|
+
name (Optional[str]): The name of the activity to update.
|
|
172
|
+
dataset_id (Optional[str]): The ID of the dataset to update the activity for.
|
|
173
|
+
description (Optional[str]): The description of the activity to update.
|
|
174
|
+
progress_schema (Optional[List[ActivitySchema]]): The progress schema of the activity to update.
|
|
175
|
+
parameter_schema (Optional[List[ActivitySchema]]): The parameter schema of the activity to update.
|
|
176
|
+
settings (Optional[dict]): The settings of the activity to update.
|
|
177
|
+
meta (Optional[dict]): The meta of the activity to update.
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
Activity: The updated activity object.
|
|
181
|
+
"""
|
|
182
|
+
response = self.request_gql(
|
|
183
|
+
Queries.UPDATE_ACTIVITY,
|
|
184
|
+
Queries.UPDATE_ACTIVITY["variables"](
|
|
185
|
+
activity_id=activity_id,
|
|
186
|
+
activity_type=activity_type,
|
|
187
|
+
name=name,
|
|
188
|
+
dataset_id=dataset_id,
|
|
189
|
+
description=description,
|
|
190
|
+
progress_schema=progress_schema,
|
|
191
|
+
parameter_schema=parameter_schema,
|
|
192
|
+
settings=settings,
|
|
193
|
+
meta=meta,
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
return Activity.model_validate(response)
|
|
197
|
+
|
|
198
|
+
def delete_activity(
|
|
199
|
+
self,
|
|
200
|
+
activity_id: str,
|
|
201
|
+
) -> bool:
|
|
202
|
+
"""Delete an activity.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
activity_id (str): The ID of the activity to delete.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
bool: True if the activity was deleted, False otherwise.
|
|
209
|
+
"""
|
|
210
|
+
response = self.request_gql(
|
|
211
|
+
Queries.DELETE_ACTIVITY,
|
|
212
|
+
Queries.DELETE_ACTIVITY["variables"](
|
|
213
|
+
activity_id=activity_id,
|
|
214
|
+
)
|
|
215
|
+
)
|
|
216
|
+
return response
|
|
217
|
+
|
|
218
|
+
def start_activity(
|
|
219
|
+
self,
|
|
220
|
+
dataset_id: str,
|
|
221
|
+
activity_id: Optional[str] = None,
|
|
222
|
+
activity_type: Optional[str] = None,
|
|
223
|
+
parameters: Union[
|
|
224
|
+
UndefinedType,
|
|
225
|
+
dict
|
|
226
|
+
] = Undefined,
|
|
227
|
+
progress: Union[
|
|
228
|
+
UndefinedType,
|
|
229
|
+
dict
|
|
230
|
+
] = Undefined,
|
|
231
|
+
meta: Union[
|
|
232
|
+
UndefinedType,
|
|
233
|
+
dict
|
|
234
|
+
] = Undefined,
|
|
235
|
+
) -> ActivityHistory:
|
|
236
|
+
"""Start an activity.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
activity_id (Optional[str]): The ID of the activity to start.
|
|
240
|
+
dataset_id (Optional[str]): The ID of the dataset to start the activity for.
|
|
241
|
+
activity_type (Optional[str]): The type of the activity to start.
|
|
242
|
+
parameters (Optional[dict]): The parameters to start the activity with.
|
|
243
|
+
progress (Optional[dict]): The progress to start the activity with.
|
|
244
|
+
meta (Optional[dict]): The meta to start the activity with.
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
ActivityHistory: The activity history object.
|
|
248
|
+
"""
|
|
249
|
+
response = self.request_gql(
|
|
250
|
+
Queries.START_ACTIVITY,
|
|
251
|
+
Queries.START_ACTIVITY["variables"](
|
|
252
|
+
dataset_id=dataset_id,
|
|
253
|
+
activity_id=activity_id,
|
|
254
|
+
activity_type=activity_type,
|
|
255
|
+
parameters=parameters,
|
|
256
|
+
progress=progress,
|
|
257
|
+
meta=meta,
|
|
258
|
+
)
|
|
259
|
+
)
|
|
260
|
+
return ActivityHistory.model_validate(response)
|
|
261
|
+
|
|
262
|
+
def update_activity_history_status(
|
|
263
|
+
self,
|
|
264
|
+
activity_history_id: str,
|
|
265
|
+
status: ActivityStatus,
|
|
266
|
+
meta: Union[
|
|
267
|
+
UndefinedType,
|
|
268
|
+
dict
|
|
269
|
+
] = Undefined,
|
|
270
|
+
) -> ActivityHistory:
|
|
271
|
+
"""Update the status of an activity history.
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
activity_history_id (str): The ID of the activity history to update.
|
|
275
|
+
status (ActivityStatus): The status to update the activity to.
|
|
276
|
+
meta (Optional[dict]): The meta to update the activity with.
|
|
277
|
+
"""
|
|
278
|
+
response = self.request_gql(
|
|
279
|
+
Queries.UPDATE_ACTIVITY_HISTORY,
|
|
280
|
+
Queries.UPDATE_ACTIVITY_HISTORY["variables"](
|
|
281
|
+
activity_history_id=activity_history_id,
|
|
282
|
+
status=status,
|
|
283
|
+
meta=meta,
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
return ActivityHistory.model_validate(response)
|
|
287
|
+
|
|
288
|
+
def update_activity_history_progress(
|
|
289
|
+
self,
|
|
290
|
+
activity_history_id: str,
|
|
291
|
+
progress: Union[
|
|
292
|
+
UndefinedType,
|
|
293
|
+
dict
|
|
294
|
+
] = Undefined,
|
|
295
|
+
meta: Union[
|
|
296
|
+
UndefinedType,
|
|
297
|
+
dict
|
|
298
|
+
] = Undefined,
|
|
299
|
+
) -> ActivityHistory:
|
|
300
|
+
"""Update the progress of an activity history.
|
|
301
|
+
|
|
302
|
+
Args:
|
|
303
|
+
activity_history_id (str): The ID of the activity history to update.
|
|
304
|
+
progress (Optional[dict]): The progress to update the activity with.
|
|
305
|
+
meta (Optional[dict]): The meta to update the activity with.
|
|
306
|
+
"""
|
|
307
|
+
response = self.request_gql(
|
|
308
|
+
Queries.UPDATE_ACTIVITY_HISTORY,
|
|
309
|
+
Queries.UPDATE_ACTIVITY_HISTORY["variables"](
|
|
310
|
+
activity_history_id=activity_history_id,
|
|
311
|
+
progress=progress,
|
|
312
|
+
meta=meta,
|
|
313
|
+
)
|
|
314
|
+
)
|
|
315
|
+
return ActivityHistory.model_validate(response)
|
spb_onprem/base_model.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
3
|
+
from pydantic import BaseModel, Field, ConfigDict
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class CustomBaseModel(BaseModel):
|
|
7
|
-
|
|
8
|
-
populate_by_name = True
|
|
7
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
9
8
|
|
|
10
9
|
def __json__(self):
|
|
11
10
|
return self.model_dump()
|
spb_onprem/entities.py
CHANGED
|
@@ -14,6 +14,13 @@ from .data.enums import (
|
|
|
14
14
|
DataMetaTypes,
|
|
15
15
|
DataMetaValue,
|
|
16
16
|
)
|
|
17
|
+
from .activities.entities import (
|
|
18
|
+
Activity,
|
|
19
|
+
ActivityHistory,
|
|
20
|
+
ActivityStatus,
|
|
21
|
+
ActivitySchema,
|
|
22
|
+
SchemaType,
|
|
23
|
+
)
|
|
17
24
|
|
|
18
25
|
__all__ = [
|
|
19
26
|
# Core Entities
|
|
@@ -25,10 +32,15 @@ __all__ = [
|
|
|
25
32
|
"DataMeta",
|
|
26
33
|
"Dataset",
|
|
27
34
|
"Slice",
|
|
35
|
+
"Activity",
|
|
36
|
+
"ActivityHistory",
|
|
28
37
|
|
|
29
38
|
# Enums
|
|
30
39
|
"DataType",
|
|
31
40
|
"SceneType",
|
|
32
41
|
"DataMetaTypes",
|
|
33
42
|
"DataMetaValue",
|
|
43
|
+
"ActivityStatus",
|
|
44
|
+
"ActivitySchema",
|
|
45
|
+
"SchemaType",
|
|
34
46
|
]
|
spb_onprem/searches.py
CHANGED
|
@@ -12,6 +12,10 @@ from .slices.params.slices import (
|
|
|
12
12
|
SlicesFilterOptions,
|
|
13
13
|
SlicesFilter,
|
|
14
14
|
)
|
|
15
|
+
from .activities.params.activities import (
|
|
16
|
+
ActivitiesFilter,
|
|
17
|
+
ActivitiesFilterOptions,
|
|
18
|
+
)
|
|
15
19
|
|
|
16
20
|
__all__ = [
|
|
17
21
|
"AnnotationFilter",
|
|
@@ -21,4 +25,6 @@ __all__ = [
|
|
|
21
25
|
"DatasetsFilterOptions",
|
|
22
26
|
"SlicesFilter",
|
|
23
27
|
"SlicesFilterOptions",
|
|
28
|
+
"ActivitiesFilter",
|
|
29
|
+
"ActivitiesFilterOptions",
|
|
24
30
|
]
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
spb_onprem/__init__.py,sha256=
|
|
2
|
-
spb_onprem/_version.py,sha256=
|
|
3
|
-
spb_onprem/base_model.py,sha256=
|
|
1
|
+
spb_onprem/__init__.py,sha256=X2jDAWU5Dp2lEfA6fCSHZbcwEyzMZJ0gS92Um9QnZlU,1586
|
|
2
|
+
spb_onprem/_version.py,sha256=iB5DfB5V6YB5Wo4JmvS-txT42QtmGaWcWp3udRT7zCI,511
|
|
3
|
+
spb_onprem/base_model.py,sha256=XLtyoxRBs68LrvbFH8V4EvQGPc2W17koC310MnS37jc,442
|
|
4
4
|
spb_onprem/base_service.py,sha256=dPfr3mGXYlqadOXycu6RBFX1HcZ1qzEsskLoOxERLOU,5737
|
|
5
5
|
spb_onprem/base_types.py,sha256=5HO6uy6qf08b4KSElwIaGy7UkoQG2KqVO6gcHbsqqSo,269
|
|
6
|
-
spb_onprem/entities.py,sha256=
|
|
6
|
+
spb_onprem/entities.py,sha256=Z3MA-W8jw-qYaCXbiMiYJxpqLUBoGVVtZpMcKsz2UJk,776
|
|
7
7
|
spb_onprem/exceptions.py,sha256=jx5rTGsVZ5shOdbgQzk8GcSyMWFtb_3xhPq6Sylwc5o,478
|
|
8
|
-
spb_onprem/searches.py,sha256=
|
|
8
|
+
spb_onprem/searches.py,sha256=JxeVkASLFtVsJYY7lmxBoDDAXcFgrj-B6HPOT2MY2tA,620
|
|
9
|
+
spb_onprem/activities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
spb_onprem/activities/queries.py,sha256=iXuNVsJuw8yt9QNw8jEBXpUnGLD6LDC1v2_jBBgsmXs,5626
|
|
11
|
+
spb_onprem/activities/service.py,sha256=DI68qkDrvpm1NW_9BzWc37kSzyedfx4xLHqMeyDjp3A,10554
|
|
12
|
+
spb_onprem/activities/entities/__init__.py,sha256=lJXPl4UqurNscZOYBcCMfRZBp27JKbPEbab5iXtL3ME,237
|
|
13
|
+
spb_onprem/activities/entities/activity.py,sha256=xVJCrtU47ZG-ALRxsOauT0fIxc9EzqkTyw1xt5qVqJQ,1358
|
|
14
|
+
spb_onprem/activities/entities/activity_history.py,sha256=rOhUDifY4P6v5rs5eNcuPD9qKkw8fbMIEn-XCWjhqSY,1035
|
|
15
|
+
spb_onprem/activities/params/__init__.py,sha256=2LzVDj92nCneoETaXS7-KM12TRLKbJX2n-7KC1Z35w0,705
|
|
16
|
+
spb_onprem/activities/params/activities.py,sha256=FUsuPIinnk_4yjvcOox5rkmcZHcz2lk2UT1A2pRoOD0,1500
|
|
17
|
+
spb_onprem/activities/params/activity.py,sha256=I1xiXuMsTGL4qYWw_MoqU3ik3j1AKJVepvXETeU_TWI,1075
|
|
18
|
+
spb_onprem/activities/params/create_activity.py,sha256=Cg_7akHgdt447JcPh5yKd7pUu_6NtE_vLF0E9Xk9mxE,2548
|
|
19
|
+
spb_onprem/activities/params/delete_activity.py,sha256=LVWJjRLhEMyQhhzpdb0oSvE_RPjZ_PABsA61V9ZoVS4,532
|
|
20
|
+
spb_onprem/activities/params/start_activity.py,sha256=uBf78FYkjGkM5g8shIoMgz8qoCoujRMRiUdaBZGF7yI,1763
|
|
21
|
+
spb_onprem/activities/params/update_activity.py,sha256=pn2sO7_2Eni1Q3ai6BbnhEInbW__N2Azs6Rmok5vDSw,2461
|
|
22
|
+
spb_onprem/activities/params/update_activity_history.py,sha256=ScWxOG7pZ-7WcTzvJleZIm-TsZVTRkwNrTCyNDyyVSc,1620
|
|
9
23
|
spb_onprem/contents/__init__.py,sha256=9EfIMQxbJuUZVUqsTa3Ji-yDidFPQQB5gnJI4R01YWI,74
|
|
10
24
|
spb_onprem/contents/queries.py,sha256=tGMVH8ixv0CW5bJTWICCjWDM_oAN7jkfEQXdAJUVn4Q,851
|
|
11
25
|
spb_onprem/contents/service.py,sha256=KoPUffr_DEGOMIOwkue0rkidHMPfmAJG0KgJyXN6N_Y,3602
|
|
@@ -62,13 +76,18 @@ spb_onprem/slices/params/__init__.py,sha256=dEUDlOK-iw3Sx7gpkDMnwMqTFE16-856ZdbY
|
|
|
62
76
|
spb_onprem/slices/params/create_slice.py,sha256=qUpX60A72Uht0SzN7b2-QSKvd_MSEV5T9kYIVk_td8A,1009
|
|
63
77
|
spb_onprem/slices/params/delete_slice.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
78
|
spb_onprem/slices/params/slice.py,sha256=R8U_RadZLWPeQu6ZWGIvXH6Dxi4ikzoHyDKWGewmUjw,1035
|
|
65
|
-
spb_onprem/slices/params/slices.py,sha256=
|
|
79
|
+
spb_onprem/slices/params/slices.py,sha256=SIe_JfsFb8ULwpRYsQkAO3aIWqqarp3m6uePmUj10tw,1935
|
|
66
80
|
spb_onprem/slices/params/update_slice.py,sha256=kryOmCnRTQ_OU0qDKgugppLrpeUpuLwmn_87M5zKqIA,1209
|
|
67
81
|
spb_onprem/users/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
82
|
spb_onprem/users/entities/__init__.py,sha256=X8HZsCTlQnuPszok3AwI-i7bsQi0Ehul5L_2jZaol5E,57
|
|
69
83
|
spb_onprem/users/entities/auth.py,sha256=_KP-7yUErBxhJMm-dE3ObprPEG6e0JI2qNg6g8aK1qM,3371
|
|
70
|
-
superb_ai_onprem-0.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
superb_ai_onprem-0.2.0.dist-info/licenses/LICENSE,sha256=CdinbFiHKGkGl6cPde6WgXhMuzyUXEG6tzy2-7udZ8o,1066
|
|
85
|
+
tests/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
86
|
+
tests/activities/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
87
|
+
tests/activities/real_test.py,sha256=0gQHg7rIEuZndGZyNHMWSD5nUZPMsUGigfCjWFxMthQ,1786
|
|
88
|
+
tests/activities/test_params.py,sha256=L3mcnrN2c8dT0AVTjnGedu6LHF3eZ4sSDzz8eaMHJmg,2369
|
|
89
|
+
tests/activities/test_service.py,sha256=AbWFwjaUjQRs5oDZ2ba0C23XJxCqsFNrxH1LamMtWmU,4698
|
|
90
|
+
superb_ai_onprem-0.2.0.dist-info/METADATA,sha256=GYkPH8YMVeOq_dEtkWRgHUOpVg6WaHLHaZLO_MmcJmE,5817
|
|
91
|
+
superb_ai_onprem-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
92
|
+
superb_ai_onprem-0.2.0.dist-info/top_level.txt,sha256=LbqU6FjWKaxO7FPS5-71e3OIS8VgBi5VrtQMWFOW25Q,17
|
|
93
|
+
superb_ai_onprem-0.2.0.dist-info/RECORD,,
|
tests/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|