-
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.
Add auto_start example scripts, update min instance version in config
- Loading branch information
Showing
4 changed files
with
88 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ | |
"files_file" | ||
] | ||
}, | ||
"instance_version": "6.11.22" | ||
"instance_version": "6.12.8" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Example on how to send API requests to ML Pipelines app from a script | ||
# Available endpoints: | ||
# 1. run_pipeline - runs a pipeline with currently selected layers on the scene | ||
# 2. get_pipeline_status - returns the status of the pipeline (e.g "Pipeline status is 21/50") | ||
|
||
import os | ||
|
||
import supervisely as sly | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv(os.path.expanduser("~/supervisely.env")) | ||
load_dotenv("local.env") | ||
|
||
team_id = sly.env.team_id() | ||
workspace_id = sly.env.workspace_id() | ||
|
||
api: sly.Api = sly.Api.from_env() | ||
|
||
task_id = 68139 | ||
|
||
is_ready = api.app.is_ready_for_api_calls(task_id) | ||
|
||
# is_ready = api.app.wait_until_ready_for_api_calls(task_id) | ||
# if is_ready: | ||
api.task.send_request(task_id=task_id, method="run_pipeline", data={}) | ||
|
||
# status = api.task.send_request(task_id=task_id, method="get_pipeline_status", data={}) | ||
# print(status) |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# AutoStart ML Pipelines from preset file | ||
|
||
import os | ||
|
||
import supervisely as sly | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv(os.path.expanduser("~/supervisely.env")) | ||
load_dotenv("local.env") | ||
|
||
team_id = sly.env.team_id() | ||
workspace_id = sly.env.workspace_id() | ||
|
||
api: sly.Api = sly.Api.from_env() | ||
|
||
agent_id = 452 # 359 | ||
app_slug = "supervisely-ecosystem/data-nodes" | ||
|
||
# preset_path = "/data-nodes/presets/images/preset.json" | ||
preset_path = "/data-nodes/presets/images/api_pipeline.json" | ||
|
||
module_id = api.app.get_ecosystem_module_id(app_slug) | ||
module_info = api.app.get_ecosystem_module_info(module_id) | ||
|
||
|
||
params = {"modalityType": "images", "slyFile": preset_path} | ||
|
||
# app_params = { | ||
# "agent_id": agent_id, | ||
# # "app_id": 0, | ||
# "module_id": module_id, | ||
# "workspace_id": workspace_id, | ||
# "description": "Start ML Pipelines from py", | ||
# "task_name": "ML Pipelines", | ||
# "params": {"autostart": False, **params}, | ||
# "app_version": None, | ||
# "is_branch": False, | ||
# } | ||
|
||
app_params = { | ||
"agent_id": agent_id, | ||
# "app_id": 0, | ||
"module_id": module_id, | ||
"workspace_id": workspace_id, | ||
"description": "Start ML Pipelines from API", | ||
"task_name": "ML Pipelines", | ||
"params": {"autostart": False, **params}, | ||
"app_version": "run-from-api", | ||
"is_branch": True, | ||
} | ||
|
||
session_info = api.app.start(**app_params) | ||
|
||
# Run pipeline | ||
is_ready = api.app.wait_until_ready_for_api_calls(session_info.task_id) | ||
if is_ready: | ||
api.task.send_request(task_id=session_info.task_id, method="run_pipeline", data={}) |