supervisely 6.73.373__py3-none-any.whl → 6.73.375__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.
- supervisely/app/widgets/__init__.py +1 -0
- supervisely/app/widgets/run_app_button/run_app_button.py +22 -2
- supervisely/app/widgets/run_app_button/script.js +105 -45
- supervisely/app/widgets/run_app_button/template.html +5 -10
- supervisely/app/widgets/select_collection/__init__.py +0 -0
- supervisely/app/widgets/select_collection/select_collection.py +693 -0
- supervisely/app/widgets/select_collection/template.html +3 -0
- supervisely/app/widgets/train_val_splits/train_val_splits.py +111 -13
- supervisely/nn/training/gui/gui.py +28 -1
- supervisely/nn/training/gui/train_val_splits_selector.py +133 -30
- supervisely/nn/training/gui/training_logs.py +4 -1
- supervisely/nn/training/gui/utils.py +23 -0
- supervisely/nn/training/train_app.py +47 -5
- supervisely/project/pointcloud_episode_project.py +16 -0
- supervisely/project/pointcloud_project.py +16 -0
- supervisely/project/project.py +57 -0
- supervisely/project/video_project.py +16 -0
- supervisely/project/volume_project.py +16 -0
- {supervisely-6.73.373.dist-info → supervisely-6.73.375.dist-info}/METADATA +1 -1
- {supervisely-6.73.373.dist-info → supervisely-6.73.375.dist-info}/RECORD +24 -21
- {supervisely-6.73.373.dist-info → supervisely-6.73.375.dist-info}/LICENSE +0 -0
- {supervisely-6.73.373.dist-info → supervisely-6.73.375.dist-info}/WHEEL +0 -0
- {supervisely-6.73.373.dist-info → supervisely-6.73.375.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.373.dist-info → supervisely-6.73.375.dist-info}/top_level.txt +0 -0
|
@@ -150,3 +150,4 @@ from supervisely.app.widgets.report_thumbnail.report_thumbnail import ReportThum
|
|
|
150
150
|
from supervisely.app.widgets.experiment_selector.experiment_selector import ExperimentSelector
|
|
151
151
|
from supervisely.app.widgets.bokeh.bokeh import Bokeh
|
|
152
152
|
from supervisely.app.widgets.run_app_button.run_app_button import RunAppButton
|
|
153
|
+
from supervisely.app.widgets.select_collection.select_collection import SelectCollection
|
|
@@ -13,6 +13,7 @@ from supervisely.app.widgets_context import JinjaWidgets
|
|
|
13
13
|
class RunAppButton(Widget):
|
|
14
14
|
def __init__(
|
|
15
15
|
self,
|
|
16
|
+
team_id: int,
|
|
16
17
|
workspace_id: int,
|
|
17
18
|
module_id: int,
|
|
18
19
|
payload: dict = None,
|
|
@@ -26,11 +27,14 @@ class RunAppButton(Widget):
|
|
|
26
27
|
icon_gap: Optional[int] = 5,
|
|
27
28
|
available_in_offline: Optional[bool] = False,
|
|
28
29
|
visible_by_vue_field: Optional[str] = "",
|
|
30
|
+
check_existing_task_cb: Optional[str] = "null",
|
|
29
31
|
widget_id: Optional[str] = None,
|
|
30
32
|
):
|
|
31
33
|
"""
|
|
32
34
|
Button the runs an app on Supervisely instance.
|
|
33
35
|
|
|
36
|
+
:param team_id: Team ID.
|
|
37
|
+
:type team_id: int
|
|
34
38
|
:param workspace_id: Workspace ID.
|
|
35
39
|
:type workspace_id: int
|
|
36
40
|
:param module_id: Module ID.
|
|
@@ -53,6 +57,8 @@ class RunAppButton(Widget):
|
|
|
53
57
|
:type available_in_offline: bool, optional
|
|
54
58
|
:param visible_by_vue_field: Vue field that controls the button visibility. If set to "isStaticVersion", the button will be visible only in offline session.
|
|
55
59
|
:type visible_by_vue_field: str, optional
|
|
60
|
+
:param check_existing_task_cb: Sets the callback function for checking existing tasks. Function should be a string (docstring) of JavaScript code.
|
|
61
|
+
:type check_existing_task_cb: str, optional
|
|
56
62
|
:param widget_id: Widget ID.
|
|
57
63
|
:type widget_id: str, optional
|
|
58
64
|
|
|
@@ -88,12 +94,13 @@ class RunAppButton(Widget):
|
|
|
88
94
|
|
|
89
95
|
self._available_in_offline = available_in_offline
|
|
90
96
|
self._visible_by_vue_field = visible_by_vue_field
|
|
91
|
-
|
|
92
97
|
self._loading = False
|
|
93
98
|
self._disabled = False
|
|
99
|
+
self._team_id = team_id
|
|
94
100
|
self._workspace_id = workspace_id
|
|
95
101
|
self._module_id = module_id
|
|
96
102
|
self._payload = payload
|
|
103
|
+
self._check_existing_task_cb = check_existing_task_cb
|
|
97
104
|
|
|
98
105
|
super().__init__(widget_id=widget_id, file_path=__file__)
|
|
99
106
|
|
|
@@ -114,6 +121,7 @@ class RunAppButton(Widget):
|
|
|
114
121
|
- available_in_offline: If True, the button will be available in offline session.
|
|
115
122
|
"""
|
|
116
123
|
return {
|
|
124
|
+
"check_existing_task_cb": self._check_existing_task_cb,
|
|
117
125
|
"options": {
|
|
118
126
|
"text": self._text,
|
|
119
127
|
"button_type": self._button_type,
|
|
@@ -123,12 +131,13 @@ class RunAppButton(Widget):
|
|
|
123
131
|
"disabled": self._disabled,
|
|
124
132
|
"icon": self._icon,
|
|
125
133
|
"available_in_offline": self._available_in_offline,
|
|
126
|
-
}
|
|
134
|
+
},
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
def get_json_state(self) -> None:
|
|
130
138
|
"""Button widget doesn't have state, so this method returns None."""
|
|
131
139
|
return {
|
|
140
|
+
"team_id": self._team_id,
|
|
132
141
|
"workspace_id": self._workspace_id,
|
|
133
142
|
"module_id": self._module_id,
|
|
134
143
|
"payload": self._payload,
|
|
@@ -298,3 +307,14 @@ class RunAppButton(Widget):
|
|
|
298
307
|
"""
|
|
299
308
|
self._disabled = value
|
|
300
309
|
DataJson()[self.widget_id]["options"]["disabled"] = self._disabled
|
|
310
|
+
|
|
311
|
+
def set_check_existing_task_cb(self, function: str) -> None:
|
|
312
|
+
"""Sets the callback function for checking existing tasks.
|
|
313
|
+
Function should be a string (docstring) of JavaScript code.
|
|
314
|
+
|
|
315
|
+
:param function: Callback function for checking existing tasks.
|
|
316
|
+
:type function: str
|
|
317
|
+
"""
|
|
318
|
+
self._check_existing_task_cb = function
|
|
319
|
+
DataJson()[self.widget_id]["check_existing_task_cb"] = self._check_existing_task_cb
|
|
320
|
+
DataJson().send_changes()
|
|
@@ -1,46 +1,106 @@
|
|
|
1
|
-
Vue.component(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
Vue.component("sly-run-app-button", {
|
|
2
|
+
props: {
|
|
3
|
+
publicApiInstance: { type: Function },
|
|
4
|
+
workspaceId: { type: Number },
|
|
5
|
+
moduleId: { type: Number },
|
|
6
|
+
payload: { type: Object },
|
|
7
|
+
options: { type: Object, default: () => ({}) },
|
|
8
|
+
groupId: { type: Number },
|
|
9
|
+
checkExistingTaskCb: { type: Function, default: null },
|
|
10
|
+
},
|
|
11
|
+
data() {
|
|
12
|
+
return {
|
|
13
|
+
loading: false,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
methods: {
|
|
17
|
+
async runApp() {
|
|
18
|
+
try {
|
|
19
|
+
this.loading = true;
|
|
20
|
+
|
|
21
|
+
if (this.checkExistingTaskCb) {
|
|
22
|
+
let checkExistingTaskCb =
|
|
23
|
+
typeof this.checkExistingTaskCb === "function"
|
|
24
|
+
? this.checkExistingTaskCb
|
|
25
|
+
: null;
|
|
26
|
+
|
|
27
|
+
if (typeof this.checkExistingTaskCb === "string") {
|
|
28
|
+
console.log("checkExistingTaskCb", this.checkExistingTaskCb);
|
|
29
|
+
try {
|
|
30
|
+
checkExistingTaskCb = new Function(
|
|
31
|
+
"task",
|
|
32
|
+
this.checkExistingTaskCb
|
|
33
|
+
);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.log("Error parsing checkExistingTaskCb string:", err);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log("Before check checkExistingTaskCb", checkExistingTaskCb);
|
|
40
|
+
if (checkExistingTaskCb) {
|
|
41
|
+
const allEntities = await this.publicApiInstance
|
|
42
|
+
.post("apps.list", {
|
|
43
|
+
withShared: true,
|
|
44
|
+
onlyRunning: true,
|
|
45
|
+
groupId: this.groupId,
|
|
46
|
+
filter: [
|
|
47
|
+
{ field: "moduleId", operator: "=", value: this.moduleId },
|
|
48
|
+
],
|
|
49
|
+
})
|
|
50
|
+
.then((res) => res.data?.entities || []);
|
|
51
|
+
|
|
52
|
+
const existTasks = allEntities.flatMap(
|
|
53
|
+
(entity) => entity.tasks || []
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (existTasks.length) {
|
|
57
|
+
const foundTask = existTasks.find((t) => checkExistingTaskCb(t));
|
|
58
|
+
console.log("foundTask", foundTask);
|
|
59
|
+
|
|
60
|
+
if (foundTask) {
|
|
61
|
+
window.open(
|
|
62
|
+
`/apps/${foundTask.meta.app.id}/sessions/${foundTask.id}`,
|
|
63
|
+
"_blank"
|
|
64
|
+
);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const tasks = await this.publicApiInstance
|
|
72
|
+
.post("tasks.run.app", {
|
|
73
|
+
params: this.payload,
|
|
74
|
+
workspaceId: this.workspaceId,
|
|
75
|
+
moduleId: this.moduleId,
|
|
76
|
+
nodeId: null,
|
|
77
|
+
})
|
|
78
|
+
.then((response) => response.data);
|
|
79
|
+
|
|
80
|
+
const task = tasks[0];
|
|
81
|
+
const origin = new URL(this.publicApiInstance.defaults.baseURL).origin;
|
|
82
|
+
window.open(
|
|
83
|
+
`${origin}/apps/${task.appId}/sessions/${task.taskId}`,
|
|
84
|
+
"_blank"
|
|
85
|
+
);
|
|
86
|
+
} finally {
|
|
87
|
+
this.loading = false;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
template: `
|
|
92
|
+
<el-button
|
|
93
|
+
:class="{'available-in-offline': options.available_in_offline}"
|
|
94
|
+
@click="runApp"
|
|
95
|
+
v-loading="options.loading || loading"
|
|
96
|
+
:type="options.button_type"
|
|
97
|
+
:plain="options.plain"
|
|
98
|
+
:size="options.button_size"
|
|
99
|
+
:disabled="options.disabled"
|
|
100
|
+
|
|
101
|
+
>
|
|
102
|
+
<span v-html="options.icon"></span>
|
|
103
|
+
<span v-html="options.text"></span>
|
|
104
|
+
</el-button>
|
|
105
|
+
`,
|
|
46
106
|
});
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
<sly-run-app-button
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
:options="data.{{{widget.widget_id}}}.options"
|
|
7
|
-
{% if widget._visible_by_vue_field %}
|
|
8
|
-
v-show="{{{widget._visible_by_vue_field}}}"
|
|
9
|
-
{% endif %}
|
|
10
|
-
></sly-run-app-button>
|
|
1
|
+
<sly-run-app-button :public-api-instance="publicApiInstance" :group-id="state.{{{widget.widget_id}}}.team_id"
|
|
2
|
+
:workspace-id="state.{{{widget.widget_id}}}.workspace_id" :module-id="state.{{{widget.widget_id}}}.module_id"
|
|
3
|
+
:payload="state.{{{widget.widget_id}}}.payload" :options="data.{{{widget.widget_id}}}.options" {% if
|
|
4
|
+
widget._visible_by_vue_field %} v-show="{{{widget._visible_by_vue_field}}}" {% endif %}
|
|
5
|
+
:check-existing-task-cb="data.{{{widget.widget_id}}}.check_existing_task_cb"></sly-run-app-button>
|
|
File without changes
|