synapse-sdk 1.0.0a64__py3-none-any.whl → 1.0.0a65__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 +20 -1
- synapse_sdk/plugins/categories/base.py +1 -0
- synapse_sdk/plugins/categories/neural_net/base/inference.py +1 -4
- synapse_sdk/plugins/models.py +12 -6
- {synapse_sdk-1.0.0a64.dist-info → synapse_sdk-1.0.0a65.dist-info}/METADATA +1 -1
- {synapse_sdk-1.0.0a64.dist-info → synapse_sdk-1.0.0a65.dist-info}/RECORD +10 -10
- {synapse_sdk-1.0.0a64.dist-info → synapse_sdk-1.0.0a65.dist-info}/WHEEL +0 -0
- {synapse_sdk-1.0.0a64.dist-info → synapse_sdk-1.0.0a65.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a64.dist-info → synapse_sdk-1.0.0a65.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-1.0.0a64.dist-info → synapse_sdk-1.0.0a65.dist-info}/top_level.txt +0 -0
|
@@ -14,19 +14,38 @@ class BackendClient(
|
|
|
14
14
|
MLClientMixin,
|
|
15
15
|
HITLClientMixin,
|
|
16
16
|
):
|
|
17
|
+
"""BackendClient is a client for the synapse backend API.
|
|
18
|
+
|
|
19
|
+
* Access token overrides authorization token and tenant token.
|
|
20
|
+
|
|
21
|
+
Attrs:
|
|
22
|
+
access_token (str): The synapse access token for the synapse backend API.
|
|
23
|
+
authorization_token (str): The authorization token for the synapse backend API.
|
|
24
|
+
tenant_token (str): The tenant token for the synapse backend API.
|
|
25
|
+
agent_token (str): The agent token for the backend API.
|
|
26
|
+
"""
|
|
27
|
+
|
|
17
28
|
name = 'Backend'
|
|
18
29
|
access_token = None
|
|
30
|
+
authorization_token = None
|
|
31
|
+
tenant_token = None
|
|
19
32
|
agent_token = None
|
|
20
33
|
|
|
21
|
-
def __init__(self, base_url, access_token=None, agent_token=None, **kwargs):
|
|
34
|
+
def __init__(self, base_url, access_token=None, token=None, tenant=None, agent_token=None, **kwargs):
|
|
22
35
|
super().__init__(base_url)
|
|
23
36
|
self.access_token = access_token
|
|
37
|
+
self.authorization_token = token
|
|
38
|
+
self.tenant_token = tenant
|
|
24
39
|
self.agent_token = agent_token
|
|
25
40
|
|
|
26
41
|
def _get_headers(self):
|
|
27
42
|
headers = {}
|
|
28
43
|
if self.access_token:
|
|
29
44
|
headers['Synapse-Access-Token'] = f'Token {self.access_token}'
|
|
45
|
+
if self.authorization_token:
|
|
46
|
+
headers['Authorization'] = f'Token {self.authorization_token}'
|
|
47
|
+
if self.tenant_token:
|
|
48
|
+
headers['Synapse-Tenant'] = f'Token {self.tenant_token}'
|
|
30
49
|
if self.agent_token:
|
|
31
50
|
headers['SYNAPSE-Agent'] = f'Token {self.agent_token}'
|
|
32
51
|
return headers
|
|
@@ -5,7 +5,6 @@ from fastapi import FastAPI
|
|
|
5
5
|
from ray import serve
|
|
6
6
|
|
|
7
7
|
from synapse_sdk.clients.backend import BackendClient
|
|
8
|
-
from synapse_sdk.devtools.config import get_backend_config
|
|
9
8
|
from synapse_sdk.utils.file import unarchive
|
|
10
9
|
|
|
11
10
|
app = FastAPI()
|
|
@@ -21,9 +20,7 @@ class BaseInference:
|
|
|
21
20
|
@serve.multiplexed()
|
|
22
21
|
async def _load_model(self, model_id: str):
|
|
23
22
|
model_info = jwt.decode(model_id, self.backend_url, algorithms='HS256')
|
|
24
|
-
|
|
25
|
-
raise ValueError('Backend config not found. Please configure backend in devtools config.')
|
|
26
|
-
client = BackendClient(config['host'], access_token=config['token'])
|
|
23
|
+
client = BackendClient(self.backend_url, token=model_info['token'], tenant=model_info['tenant'])
|
|
27
24
|
model = client.get_model(model_info['model'])
|
|
28
25
|
with tempfile.TemporaryDirectory() as temp_path:
|
|
29
26
|
unarchive(model['file'], temp_path)
|
synapse_sdk/plugins/models.py
CHANGED
|
@@ -113,12 +113,18 @@ class Run:
|
|
|
113
113
|
def __init__(self, job_id, context):
|
|
114
114
|
self.job_id = job_id
|
|
115
115
|
self.context = context
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
config = get_backend_config()
|
|
117
|
+
if config:
|
|
118
|
+
self.client = BackendClient(
|
|
119
|
+
config['host'],
|
|
120
|
+
access_token=config['token'],
|
|
121
|
+
)
|
|
122
|
+
else:
|
|
123
|
+
self.client = BackendClient(
|
|
124
|
+
self.context['envs']['SYNAPSE_PLUGIN_RUN_HOST'],
|
|
125
|
+
token=self.context['envs'].get('SYNAPSE_PLUGIN_RUN_USER_TOKEN'),
|
|
126
|
+
tenant=self.context['envs'].get('SYNAPSE_PLUGIN_RUN_TENANT'),
|
|
127
|
+
)
|
|
122
128
|
self.set_logger()
|
|
123
129
|
|
|
124
130
|
def set_logger(self):
|
|
@@ -30,7 +30,7 @@ synapse_sdk/clients/agent/__init__.py,sha256=FqYbtzMJdzRfuU2SA-Yxdc0JKmVP1wxH6Ol
|
|
|
30
30
|
synapse_sdk/clients/agent/core.py,sha256=x2jgORTjT7pJY67SLuc-5lMG6CD5OWpy8UgGeTf7IhA,270
|
|
31
31
|
synapse_sdk/clients/agent/ray.py,sha256=1EDl-bMN2CvKl07-qMidSWNOGpvIvzcWl7jDBCza65o,3248
|
|
32
32
|
synapse_sdk/clients/agent/service.py,sha256=s7KuPK_DB1nr2VHrigttV1WyFonaGHNrPvU8loRxHcE,478
|
|
33
|
-
synapse_sdk/clients/backend/__init__.py,sha256=
|
|
33
|
+
synapse_sdk/clients/backend/__init__.py,sha256=ZIOtyumZUw2u1k71rf5CjMCqhR1RwRTKJaZ19sCuTuE,1947
|
|
34
34
|
synapse_sdk/clients/backend/annotation.py,sha256=dX7os4zFxI3oyh8SzqB83eTW_mR07Hp2bhCHwe64AkE,1356
|
|
35
35
|
synapse_sdk/clients/backend/core.py,sha256=5XAOdo6JZ0drfk-FMPJ96SeTd9oja-VnTwzGXdvK7Bg,1027
|
|
36
36
|
synapse_sdk/clients/backend/data_collection.py,sha256=uI-_ByLh-Xez4VIIVRBO8FCNUpDcxhBcLxCVFb_aG7o,4104
|
|
@@ -108,11 +108,11 @@ synapse_sdk/devtools/web/src/views/PluginView.jsx,sha256=_-V8elSiEtsvKECeROtQopS
|
|
|
108
108
|
synapse_sdk/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
109
109
|
synapse_sdk/plugins/enums.py,sha256=ibixwqA3sCNSriG1jAtL54JQc_Zwo3MufwYUqGhVncc,523
|
|
110
110
|
synapse_sdk/plugins/exceptions.py,sha256=Qs7qODp_RRLO9y2otU2T4ryj5LFwIZODvSIXkAh91u0,691
|
|
111
|
-
synapse_sdk/plugins/models.py,sha256=
|
|
111
|
+
synapse_sdk/plugins/models.py,sha256=dte0Thx4O8KS5WKrtERbtOmyZ85MG_TFqE6FUCplkjk,4645
|
|
112
112
|
synapse_sdk/plugins/upload.py,sha256=VJOotYMayylOH0lNoAGeGHRkLdhP7jnC_A0rFQMvQpQ,3228
|
|
113
113
|
synapse_sdk/plugins/utils.py,sha256=4_K6jIl0WrsXOEhFp94faMOriSsddOhIiaXcawYYUUA,3300
|
|
114
114
|
synapse_sdk/plugins/categories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
115
|
-
synapse_sdk/plugins/categories/base.py,sha256=
|
|
115
|
+
synapse_sdk/plugins/categories/base.py,sha256=ZBgRh3tTdSnqBrzjux8oi1_3PidHMmpmLClPXiTmU3Q,10690
|
|
116
116
|
synapse_sdk/plugins/categories/decorators.py,sha256=Gw6T-UHwpCKrSt596X-g2sZbY_Z1zbbogowClj7Pr5Q,518
|
|
117
117
|
synapse_sdk/plugins/categories/registry.py,sha256=KdQR8SUlLT-3kgYzDNWawS1uJnAhrcw2j4zFaTpilRs,636
|
|
118
118
|
synapse_sdk/plugins/categories/templates.py,sha256=FF5FerhkZMeW1YcKLY5cylC0SkWSYdJODA_Qcm4OGYQ,887
|
|
@@ -138,7 +138,7 @@ synapse_sdk/plugins/categories/neural_net/actions/test.py,sha256=JY25eg-Fo6WbgtM
|
|
|
138
138
|
synapse_sdk/plugins/categories/neural_net/actions/train.py,sha256=i406Ar0V74QwdvqI_g_DgHblB_SoGRPMsuwWcxfoeew,5429
|
|
139
139
|
synapse_sdk/plugins/categories/neural_net/actions/tune.py,sha256=C2zv3o0S-5Hjjsms8ULDGD-ad_DdNTqCPOcDqXa0v1Y,13494
|
|
140
140
|
synapse_sdk/plugins/categories/neural_net/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
141
|
-
synapse_sdk/plugins/categories/neural_net/base/inference.py,sha256=
|
|
141
|
+
synapse_sdk/plugins/categories/neural_net/base/inference.py,sha256=R5DASI6-5vzsjDOYxqeGGMBjnav5qHF4hNJT8zNUR3I,1097
|
|
142
142
|
synapse_sdk/plugins/categories/neural_net/templates/config.yaml,sha256=TMdvthf0zQYYTHf0IibKJ6InziRCWM4100C1DKkJVqU,1094
|
|
143
143
|
synapse_sdk/plugins/categories/neural_net/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
144
144
|
synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py,sha256=rXvECCewVlLSotv7UaIyyGfEv0OODlXBuk1JwBLNhh8,838
|
|
@@ -205,9 +205,9 @@ synapse_sdk/utils/storage/providers/__init__.py,sha256=x7RGwZryT2FpVxS7fGWryRVpq
|
|
|
205
205
|
synapse_sdk/utils/storage/providers/gcp.py,sha256=i2BQCu1Kej1If9SuNr2_lEyTcr5M_ncGITZrL0u5wEA,363
|
|
206
206
|
synapse_sdk/utils/storage/providers/s3.py,sha256=W94rQvhGRXti3R4mYP7gmU5pcyCQpGFIBLvxxqLVdRM,2231
|
|
207
207
|
synapse_sdk/utils/storage/providers/sftp.py,sha256=_8s9hf0JXIO21gvm-JVS00FbLsbtvly4c-ETLRax68A,1426
|
|
208
|
-
synapse_sdk-1.0.
|
|
209
|
-
synapse_sdk-1.0.
|
|
210
|
-
synapse_sdk-1.0.
|
|
211
|
-
synapse_sdk-1.0.
|
|
212
|
-
synapse_sdk-1.0.
|
|
213
|
-
synapse_sdk-1.0.
|
|
208
|
+
synapse_sdk-1.0.0a65.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
|
|
209
|
+
synapse_sdk-1.0.0a65.dist-info/METADATA,sha256=tZri6hM4wsmNTYDKgWGfrmgxYa1LKGUz1f-ad8Xzwoo,1130
|
|
210
|
+
synapse_sdk-1.0.0a65.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
211
|
+
synapse_sdk-1.0.0a65.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
|
|
212
|
+
synapse_sdk-1.0.0a65.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
|
|
213
|
+
synapse_sdk-1.0.0a65.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|