synapse-sdk 1.0.0a13__py3-none-any.whl → 1.0.0a15__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 synapse-sdk might be problematic. Click here for more details.
- synapse_sdk/clients/backend/__init__.py +6 -2
- synapse_sdk/clients/backend/dataset.py +1 -1
- synapse_sdk/clients/backend/integration.py +3 -3
- synapse_sdk/clients/backend/ml.py +1 -1
- synapse_sdk/plugins/categories/base.py +2 -2
- synapse_sdk/plugins/cli/publish.py +2 -1
- synapse_sdk/plugins/models.py +8 -10
- synapse_sdk/plugins/utils.py +42 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-1.0.0a15.dist-info}/METADATA +1 -1
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-1.0.0a15.dist-info}/RECORD +14 -14
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-1.0.0a15.dist-info}/LICENSE +0 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-1.0.0a15.dist-info}/WHEEL +0 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-1.0.0a15.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-1.0.0a15.dist-info}/top_level.txt +0 -0
|
@@ -8,16 +8,20 @@ class BackendClient(AnnotationClientMixin, DatasetClientMixin, IntegrationClient
|
|
|
8
8
|
name = 'Backend'
|
|
9
9
|
token = None
|
|
10
10
|
tenant = None
|
|
11
|
+
agent_token = None
|
|
11
12
|
|
|
12
|
-
def __init__(self, base_url, token=None, tenant=None):
|
|
13
|
+
def __init__(self, base_url, token=None, tenant=None, agent_token=None):
|
|
13
14
|
super().__init__(base_url)
|
|
14
15
|
self.token = token
|
|
15
16
|
self.tenant = tenant
|
|
17
|
+
self.agent_token = agent_token
|
|
16
18
|
|
|
17
19
|
def _get_headers(self):
|
|
18
20
|
headers = {}
|
|
19
21
|
if self.token:
|
|
20
|
-
headers
|
|
22
|
+
headers['Authorization'] = f'Token {self.token}'
|
|
21
23
|
if self.tenant:
|
|
22
24
|
headers['SYNAPSE-Tenant'] = f'Token {self.tenant}'
|
|
25
|
+
if self.agent_token:
|
|
26
|
+
headers['SYNAPSE-Agent'] = f'Token {self.agent_token}'
|
|
23
27
|
return headers
|
|
@@ -9,7 +9,7 @@ from synapse_sdk.clients.utils import get_batched_list
|
|
|
9
9
|
class DatasetClientMixin(BaseClient):
|
|
10
10
|
def list_dataset(self):
|
|
11
11
|
path = 'datasets/'
|
|
12
|
-
return self.
|
|
12
|
+
return self._list(path)
|
|
13
13
|
|
|
14
14
|
def create_data_file(self, file_path):
|
|
15
15
|
path = 'data_files/'
|
|
@@ -37,7 +37,7 @@ class IntegrationClientMixin(BaseClient):
|
|
|
37
37
|
|
|
38
38
|
def list_jobs(self, params=None):
|
|
39
39
|
path = 'jobs/'
|
|
40
|
-
return self.
|
|
40
|
+
return self._list(path, params=params)
|
|
41
41
|
|
|
42
42
|
def update_job(self, pk, data):
|
|
43
43
|
path = f'jobs/{pk}/'
|
|
@@ -66,6 +66,6 @@ class IntegrationClientMixin(BaseClient):
|
|
|
66
66
|
path = 'serve_applications/'
|
|
67
67
|
return self._post(path, data=data)
|
|
68
68
|
|
|
69
|
-
def list_serve_applications(self, params=None):
|
|
69
|
+
def list_serve_applications(self, params=None, list_all=False):
|
|
70
70
|
path = 'serve_applications/'
|
|
71
|
-
return self.
|
|
71
|
+
return self._list(path, params=params, list_all=list_all)
|
|
@@ -5,7 +5,7 @@ from synapse_sdk.clients.utils import get_default_url_conversion
|
|
|
5
5
|
class MLClientMixin(BaseClient):
|
|
6
6
|
def list_models(self, params=None):
|
|
7
7
|
path = 'models/'
|
|
8
|
-
return self.
|
|
8
|
+
return self._list(path, params=params)
|
|
9
9
|
|
|
10
10
|
def get_model(self, pk, params=None, url_conversion=None):
|
|
11
11
|
path = f'models/{pk}/'
|
|
@@ -36,7 +36,7 @@ class Action:
|
|
|
36
36
|
envs = None
|
|
37
37
|
run = None
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
REQUIRED_ENVS = [
|
|
40
40
|
'RAY_ADDRESS',
|
|
41
41
|
'RAY_DASHBOARD_URL',
|
|
42
42
|
'RAY_SERVE_ADDRESS',
|
|
@@ -112,7 +112,7 @@ class Action:
|
|
|
112
112
|
return self.run_class(self.job_id, context)
|
|
113
113
|
|
|
114
114
|
def get_default_envs(self):
|
|
115
|
-
return {env: os.environ[env] for env in self.
|
|
115
|
+
return {env: os.environ[env] for env in self.REQUIRED_ENVS if env in os.environ}
|
|
116
116
|
|
|
117
117
|
def get_runtime_env(self):
|
|
118
118
|
runtime_env = {
|
|
@@ -26,7 +26,8 @@ def publish(ctx, host, user_token, tenant, debug_modules):
|
|
|
26
26
|
|
|
27
27
|
data = {'plugin': plugin_release.plugin, 'file': str(archive_path), 'debug': debug}
|
|
28
28
|
if debug:
|
|
29
|
-
|
|
29
|
+
if debug_modules:
|
|
30
|
+
data['debug_meta'] = json.dumps({'modules': debug_modules.split(',')})
|
|
30
31
|
|
|
31
32
|
client = BackendClient(host, user_token, tenant=tenant)
|
|
32
33
|
client.create_plugin_release(data)
|
synapse_sdk/plugins/models.py
CHANGED
|
@@ -86,28 +86,26 @@ class Run:
|
|
|
86
86
|
logger = None
|
|
87
87
|
job_id = None
|
|
88
88
|
context = None
|
|
89
|
+
client = None
|
|
89
90
|
|
|
90
91
|
def __init__(self, job_id, context):
|
|
91
92
|
self.job_id = job_id
|
|
92
93
|
self.context = context
|
|
94
|
+
self.client = BackendClient(
|
|
95
|
+
self.context['envs']['SYNAPSE_PLUGIN_RUN_HOST'],
|
|
96
|
+
self.context['envs']['SYNAPSE_PLUGIN_RUN_USER_TOKEN'],
|
|
97
|
+
self.context['envs']['SYNAPSE_PLUGIN_RUN_TENANT'],
|
|
98
|
+
)
|
|
93
99
|
self.set_logger()
|
|
94
100
|
|
|
95
101
|
def set_logger(self):
|
|
96
102
|
kwargs = {'progress_categories': self.context['progress_categories']}
|
|
103
|
+
|
|
97
104
|
if self.job_id:
|
|
98
|
-
|
|
99
|
-
self.context['envs']['SYNAPSE_PLUGIN_RUN_HOST'],
|
|
100
|
-
self.context['envs']['SYNAPSE_PLUGIN_RUN_USER_TOKEN'],
|
|
101
|
-
self.context['envs']['SYNAPSE_PLUGIN_RUN_TENANT'],
|
|
102
|
-
)
|
|
103
|
-
self.logger = BackendLogger(client, self.job_id, **kwargs)
|
|
105
|
+
self.logger = BackendLogger(self.client, self.job_id, **kwargs)
|
|
104
106
|
else:
|
|
105
107
|
self.logger = ConsoleLogger(**kwargs)
|
|
106
108
|
|
|
107
|
-
@property
|
|
108
|
-
def client(self):
|
|
109
|
-
return getattr(self.logger, 'client', None)
|
|
110
|
-
|
|
111
109
|
def set_progress(self, current, total, category=''):
|
|
112
110
|
self.logger.set_progress(current, total, category)
|
|
113
111
|
|
synapse_sdk/plugins/utils.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
|
|
4
|
+
from synapse_sdk.i18n import gettext as _
|
|
4
5
|
from synapse_sdk.plugins.categories.registry import _REGISTERED_ACTIONS, register_actions
|
|
5
6
|
from synapse_sdk.plugins.enums import PluginCategory
|
|
7
|
+
from synapse_sdk.plugins.exceptions import ActionError
|
|
6
8
|
from synapse_sdk.utils.file import get_dict_from_file
|
|
7
9
|
|
|
8
10
|
|
|
@@ -48,3 +50,43 @@ def read_plugin_config(plugin_path=None):
|
|
|
48
50
|
else:
|
|
49
51
|
config_path = config_file_name
|
|
50
52
|
return get_dict_from_file(config_path)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def run_plugin(action, params, plugin_config=None, plugin_path=None, modules=None, envs=None, debug=False, **kwargs):
|
|
56
|
+
from synapse_sdk.plugins.models import PluginRelease
|
|
57
|
+
|
|
58
|
+
if not envs:
|
|
59
|
+
envs = {}
|
|
60
|
+
|
|
61
|
+
if debug:
|
|
62
|
+
if not plugin_path:
|
|
63
|
+
raise ActionError({'plugin_path': _('디버그 모드에서는 plugin_path는 필수입니다.')})
|
|
64
|
+
|
|
65
|
+
if plugin_path.startswith('http'):
|
|
66
|
+
if not plugin_config:
|
|
67
|
+
raise ActionError({'config': _('"plugin_path"가 url인 경우에는 "config"가 필수입니다.')})
|
|
68
|
+
plugin_release = PluginRelease(config=plugin_config)
|
|
69
|
+
else:
|
|
70
|
+
plugin_release = PluginRelease(plugin_path=plugin_path)
|
|
71
|
+
plugin_config = plugin_release.config
|
|
72
|
+
|
|
73
|
+
if action not in plugin_release.actions:
|
|
74
|
+
raise ActionError({'action': _('해당 액션은 존재하지 않습니다.')})
|
|
75
|
+
|
|
76
|
+
envs['SYNAPSE_DEBUG_PLUGIN_PATH'] = plugin_path
|
|
77
|
+
if modules:
|
|
78
|
+
envs['SYNAPSE_DEBUG_MODULES'] = ','.join(modules)
|
|
79
|
+
else:
|
|
80
|
+
if plugin_config is None:
|
|
81
|
+
raise ActionError({'config': _('플러그인 설정은 필수입니다.')})
|
|
82
|
+
|
|
83
|
+
action = get_action(
|
|
84
|
+
action,
|
|
85
|
+
params,
|
|
86
|
+
config=plugin_config,
|
|
87
|
+
envs=envs,
|
|
88
|
+
debug=debug,
|
|
89
|
+
**kwargs,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
return action.run_action()
|
|
@@ -15,22 +15,22 @@ synapse_sdk/clients/agent/__init__.py,sha256=Pz8_iTbIbnb7ywGJ3feqoZVmO2I3mEbwpWs
|
|
|
15
15
|
synapse_sdk/clients/agent/core.py,sha256=YicfkO0YvjDDOt1jNWoZ0mokrh8xxKibBL4qF5yOjKs,169
|
|
16
16
|
synapse_sdk/clients/agent/ray.py,sha256=JrwLyVOUDG2yYsbPrxyUtWbM-FWp9B6Bl_GdDby0rt8,1559
|
|
17
17
|
synapse_sdk/clients/agent/service.py,sha256=s7KuPK_DB1nr2VHrigttV1WyFonaGHNrPvU8loRxHcE,478
|
|
18
|
-
synapse_sdk/clients/backend/__init__.py,sha256=
|
|
18
|
+
synapse_sdk/clients/backend/__init__.py,sha256=50MW1CMWGaKnALSv2fOjhJZG55Xb3yrqlKtnSZldwcU,1004
|
|
19
19
|
synapse_sdk/clients/backend/annotation.py,sha256=eZc5EidgR_RfMGwvv1r1_mLkPdRd8e52c4zuuMjMX34,979
|
|
20
|
-
synapse_sdk/clients/backend/dataset.py,sha256=
|
|
21
|
-
synapse_sdk/clients/backend/integration.py,sha256=
|
|
22
|
-
synapse_sdk/clients/backend/ml.py,sha256=
|
|
20
|
+
synapse_sdk/clients/backend/dataset.py,sha256=a_svyCKgzF7N99l8V4u4wXD8JxiGuLW9z2EBinnz7b8,1738
|
|
21
|
+
synapse_sdk/clients/backend/integration.py,sha256=Jg_8fEmbrgYXfZZcG8cDtLxR6ugPmnbNhPDyRu_Uib0,2160
|
|
22
|
+
synapse_sdk/clients/backend/ml.py,sha256=lg978cCMcPiLN4ByjhrSlJHlw1_kgZQgaNZNKr9zPsI,1054
|
|
23
23
|
synapse_sdk/clients/ray/__init__.py,sha256=9ZSPXVVxlJ8Wp8ku7l021ENtPjVrGgQDgqifkkVAXgM,187
|
|
24
24
|
synapse_sdk/clients/ray/core.py,sha256=a4wyCocAma2HAm-BHlbZnoVbpfdR-Aad2FM0z6vPFvw,731
|
|
25
25
|
synapse_sdk/clients/ray/serve.py,sha256=rbCpXZYWf0oP8XJ9faa9QFNPYU7h8dltIG8xn9ZconY,907
|
|
26
26
|
synapse_sdk/plugins/__init__.py,sha256=9vsbYhxah4_ofTaG0x0qLFID_raHNkO57Y8A31Ws-lU,222
|
|
27
27
|
synapse_sdk/plugins/enums.py,sha256=s59P6Oz2WAK9IX-kLVhNOvNKYJifKlWBhPpZbc9-ttE,486
|
|
28
28
|
synapse_sdk/plugins/exceptions.py,sha256=Qs7qODp_RRLO9y2otU2T4ryj5LFwIZODvSIXkAh91u0,691
|
|
29
|
-
synapse_sdk/plugins/models.py,sha256=
|
|
29
|
+
synapse_sdk/plugins/models.py,sha256=T3ZuTw7BZwMKpz2QGaErnEPetKRD9d4z3qceJkV363o,3541
|
|
30
30
|
synapse_sdk/plugins/upload.py,sha256=VJOotYMayylOH0lNoAGeGHRkLdhP7jnC_A0rFQMvQpQ,3228
|
|
31
|
-
synapse_sdk/plugins/utils.py,sha256=
|
|
31
|
+
synapse_sdk/plugins/utils.py,sha256=UYkwxkmrs0-mRgQB63SkTGD1HpIQEIiHndzTcpdNaF4,2936
|
|
32
32
|
synapse_sdk/plugins/categories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
|
-
synapse_sdk/plugins/categories/base.py,sha256=
|
|
33
|
+
synapse_sdk/plugins/categories/base.py,sha256=Q14bnUTdPLeNeFodcOBMr9Z0d8LM1VRIq-pl8vTKgTc,8093
|
|
34
34
|
synapse_sdk/plugins/categories/decorators.py,sha256=Gw6T-UHwpCKrSt596X-g2sZbY_Z1zbbogowClj7Pr5Q,518
|
|
35
35
|
synapse_sdk/plugins/categories/registry.py,sha256=KdQR8SUlLT-3kgYzDNWawS1uJnAhrcw2j4zFaTpilRs,636
|
|
36
36
|
synapse_sdk/plugins/categories/templates.py,sha256=FF5FerhkZMeW1YcKLY5cylC0SkWSYdJODA_Qcm4OGYQ,887
|
|
@@ -76,7 +76,7 @@ synapse_sdk/plugins/categories/smart_tool/templates/config.yaml,sha256=3jxW8daip
|
|
|
76
76
|
synapse_sdk/plugins/categories/smart_tool/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
77
|
synapse_sdk/plugins/categories/smart_tool/templates/plugin/auto_label.py,sha256=eevNg0nOcYFR4z_L_R-sCvVOYoLWSAH1jwDkAf3YCjY,320
|
|
78
78
|
synapse_sdk/plugins/cli/__init__.py,sha256=LPtUO0jqkhKq6xR1grpse7da2R6OoT_BeDyCNyUY0T4,380
|
|
79
|
-
synapse_sdk/plugins/cli/publish.py,sha256=
|
|
79
|
+
synapse_sdk/plugins/cli/publish.py,sha256=rhUtJsKhYyeDTQlul8mQthfMeNuQCou64faHyaP9y1c,1230
|
|
80
80
|
synapse_sdk/plugins/cli/run.py,sha256=lw1KbsL-xTGllF4NtD2cq-Rh6HMbhi-sO862_Ds-sUo,2330
|
|
81
81
|
synapse_sdk/plugins/templates/cookiecutter.json,sha256=NxOWk9A_v1pO0Ny4IYT9Cj5iiJ16--cIQrGC67QdR0I,396
|
|
82
82
|
synapse_sdk/plugins/templates/hooks/post_gen_project.py,sha256=jqlYkY1O2TxIR-Vh3gnwILYy8k-D39Xx66d2KNQVMCs,147
|
|
@@ -103,9 +103,9 @@ synapse_sdk/utils/pydantic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
103
103
|
synapse_sdk/utils/pydantic/config.py,sha256=1vYOcUI35GslfD1rrqhFkNXXJOXt4IDqOPSx9VWGfNE,123
|
|
104
104
|
synapse_sdk/utils/pydantic/errors.py,sha256=0v0T12eQBr1KrFiEOBu6KMaPK4aPEGEC6etPJGoR5b4,1061
|
|
105
105
|
synapse_sdk/utils/pydantic/validators.py,sha256=G47P8ObPhsePmd_QZDK8EdPnik2CbaYzr_N4Z6En8dc,193
|
|
106
|
-
synapse_sdk-1.0.
|
|
107
|
-
synapse_sdk-1.0.
|
|
108
|
-
synapse_sdk-1.0.
|
|
109
|
-
synapse_sdk-1.0.
|
|
110
|
-
synapse_sdk-1.0.
|
|
111
|
-
synapse_sdk-1.0.
|
|
106
|
+
synapse_sdk-1.0.0a15.dist-info/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
|
|
107
|
+
synapse_sdk-1.0.0a15.dist-info/METADATA,sha256=Wh0N4QJ0Hy4XMeV9YUvIHoQUGRNYklUvVnPMv9E7Bbs,1049
|
|
108
|
+
synapse_sdk-1.0.0a15.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
109
|
+
synapse_sdk-1.0.0a15.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
|
|
110
|
+
synapse_sdk-1.0.0a15.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
|
|
111
|
+
synapse_sdk-1.0.0a15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|