-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from supervisely-ecosystem/workflow-test
Add Workflow
- Loading branch information
Showing
4 changed files
with
46 additions
and
3 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 |
---|---|---|
@@ -1 +1 @@ | ||
supervisely==6.73.97 | ||
supervisely==6.73.123 |
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,39 @@ | ||
import supervisely as sly | ||
import os | ||
|
||
|
||
def check_compatibility(func): | ||
def wrapper(self, *args, **kwargs): | ||
if self.is_compatible is None: | ||
self.is_compatible = self.check_instance_ver_compatibility() | ||
if not self.is_compatible: | ||
return | ||
return func(self, *args, **kwargs) | ||
|
||
return wrapper | ||
|
||
|
||
class Workflow: | ||
def __init__(self, api: sly.Api, min_instance_version: str = None): | ||
self.is_compatible = None | ||
self.api = api | ||
self._min_instance_version = ( | ||
"6.9.31" if min_instance_version is None else min_instance_version | ||
) | ||
|
||
def check_instance_ver_compatibility(self): | ||
if self.api.instance_version < self._min_instance_version: | ||
sly.logger.info( | ||
f"Supervisely instance version does not support workflow and versioning features. To use them, please update your instance minimum to version {self._min_instance_version}." | ||
) | ||
return False | ||
return True | ||
|
||
@check_compatibility | ||
def add_input(self): | ||
raise NotImplementedError("Method is not implemented yet.") | ||
|
||
@check_compatibility | ||
def add_output(self, project_id: int): | ||
self.api.app.workflow.add_output_project(project_id) | ||
|