synapse-sdk 1.0.0a8__tar.gz → 1.0.0a10__tar.gz
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-1.0.0a8 → synapse_sdk-1.0.0a10}/.github/workflows/pypi-publish.yml +4 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/.gitignore +3 -1
- synapse_sdk-1.0.0a10/PKG-INFO +43 -0
- synapse_sdk-1.0.0a10/README.md +22 -0
- synapse_sdk-1.0.0a10/messages.pot +34 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/requirements.txt +1 -1
- synapse_sdk-1.0.0a10/synapse_sdk/clients/agent/__init__.py +51 -0
- synapse_sdk-1.0.0a10/synapse_sdk/clients/agent/core.py +7 -0
- synapse_sdk-1.0.0a8/synapse_sdk/clients/agent/service.py → synapse_sdk-1.0.0a10/synapse_sdk/clients/agent/ray.py +13 -13
- synapse_sdk-1.0.0a10/synapse_sdk/clients/agent/service.py +15 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/backend/__init__.py +5 -4
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/backend/integration.py +8 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/backend/ml.py +4 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/base.py +7 -1
- synapse_sdk-1.0.0a10/synapse_sdk/clients/ray/__init__.py +6 -0
- synapse_sdk-1.0.0a10/synapse_sdk/clients/ray/core.py +22 -0
- synapse_sdk-1.0.0a10/synapse_sdk/clients/ray/serve.py +20 -0
- synapse_sdk-1.0.0a10/synapse_sdk/i18n.py +35 -0
- synapse_sdk-1.0.0a10/synapse_sdk/locale/en/LC_MESSAGES/messages.po +39 -0
- synapse_sdk-1.0.0a10/synapse_sdk/locale/ko/LC_MESSAGES/messages.po +34 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/loggers.py +3 -3
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/base.py +39 -10
- synapse_sdk-1.0.0a10/synapse_sdk/plugins/categories/neural_net/actions/deployment.py +45 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/actions/inference.py +8 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/actions/train.py +7 -6
- synapse_sdk-1.0.0a10/synapse_sdk/plugins/categories/smart_tool/actions/auto_label.py +37 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/smart_tool/templates/config.yaml +1 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/cli/__init__.py +3 -1
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/cli/publish.py +2 -1
- synapse_sdk-1.0.0a10/synapse_sdk/plugins/exceptions.py +22 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/models.py +26 -7
- synapse_sdk-1.0.0a10/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env.dist +24 -0
- synapse_sdk-1.0.0a10/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/main.py +4 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/upload.py +2 -1
- synapse_sdk-1.0.0a10/synapse_sdk/shared/enums.py +8 -0
- synapse_sdk-1.0.0a10/synapse_sdk/utils/debug.py +5 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/utils/file.py +2 -0
- synapse_sdk-1.0.0a10/synapse_sdk/utils/pydantic/__init__.py +0 -0
- synapse_sdk-1.0.0a10/synapse_sdk.egg-info/PKG-INFO +43 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk.egg-info/SOURCES.txt +13 -0
- synapse_sdk-1.0.0a8/PKG-INFO +0 -22
- synapse_sdk-1.0.0a8/README.md +0 -1
- synapse_sdk-1.0.0a8/synapse_sdk/clients/agent/__init__.py +0 -21
- synapse_sdk-1.0.0a8/synapse_sdk/plugins/categories/neural_net/actions/deployment.py +0 -24
- synapse_sdk-1.0.0a8/synapse_sdk/plugins/categories/smart_tool/actions/auto_label.py +0 -22
- synapse_sdk-1.0.0a8/synapse_sdk/plugins/exceptions.py +0 -6
- synapse_sdk-1.0.0a8/synapse_sdk/utils/debug.py +0 -2
- synapse_sdk-1.0.0a8/synapse_sdk.egg-info/PKG-INFO +0 -22
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/.github/workflows/lint.yml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/.pre-commit-config.yaml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/LICENSE +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/pyproject.toml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/setup.cfg +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/cli/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/cli/create_plugin.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/backend/annotation.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/backend/dataset.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/exceptions.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/clients/utils.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/data_validation/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/data_validation/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/data_validation/actions/validation.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/data_validation/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/data_validation/templates/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/decorators.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/export/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/export/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/export/actions/export.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/import/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/import/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/import/actions/import.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/actions/test.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/templates/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/templates/plugin/test.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/neural_net/templates/plugin/train.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/post_annotation/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/post_annotation/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/post_annotation/actions/post_annotation.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/post_annotation/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/post_annotation/templates/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/post_annotation/templates/plugin/post_annotation.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/pre_annotation/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/pre_annotation/templates/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/pre_annotation/templates/plugin/pre_annotation.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/registry.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/smart_tool/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/smart_tool/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/smart_tool/templates/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/smart_tool/templates/plugin/auto_label.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/categories/templates.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/cli/run.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/enums.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/cookiecutter.json +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/hooks/post_gen_project.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/hooks/pre_prompt.py +0 -0
- /synapse_sdk-1.0.0a8/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env.dist → /synapse_sdk-1.0.0a10/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.gitignore +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.pre-commit-config.yaml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/README.md +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/config.yaml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/pyproject.toml +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/requirements.txt +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/plugins/utils.py +0 -0
- {synapse_sdk-1.0.0a8/synapse_sdk/utils → synapse_sdk-1.0.0a10/synapse_sdk/shared}/__init__.py +0 -0
- {synapse_sdk-1.0.0a8/synapse_sdk/utils/pydantic → synapse_sdk-1.0.0a10/synapse_sdk/utils}/__init__.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/utils/module_loading.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/utils/pydantic/config.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/utils/pydantic/errors.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/utils/pydantic/validators.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/utils/storage.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk/utils/string.py +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk.egg-info/dependency_links.txt +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk.egg-info/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk.egg-info/requires.txt +0 -0
- {synapse_sdk-1.0.0a8 → synapse_sdk-1.0.0a10}/synapse_sdk.egg-info/top_level.txt +0 -0
|
@@ -27,6 +27,10 @@ jobs:
|
|
|
27
27
|
run: |
|
|
28
28
|
python -m pip install --upgrade pip
|
|
29
29
|
pip install build
|
|
30
|
+
- name: Compile i18n messages
|
|
31
|
+
run : |
|
|
32
|
+
msgfmt synapse_sdk/locale/ko/LC_MESSAGES/messages.po -o synapse_sdk/locale/ko/LC_MESSAGES/messages.mo
|
|
33
|
+
msgfmt synapse_sdk/locale/en/LC_MESSAGES/messages.po -o synapse_sdk/locale/en/LC_MESSAGES/messages.mo
|
|
30
34
|
- name: Build package
|
|
31
35
|
run: python -m build
|
|
32
36
|
- name: Store the distribution packages
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: synapse-sdk
|
|
3
|
+
Version: 1.0.0a10
|
|
4
|
+
Summary: synapse sdk
|
|
5
|
+
Author-email: datamaker <developer@datamaker.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: boto3
|
|
12
|
+
Requires-Dist: click
|
|
13
|
+
Requires-Dist: cookiecutter
|
|
14
|
+
Requires-Dist: requests
|
|
15
|
+
Requires-Dist: tqdm
|
|
16
|
+
Requires-Dist: python-dotenv
|
|
17
|
+
Requires-Dist: pyyaml
|
|
18
|
+
Requires-Dist: pydantic
|
|
19
|
+
Provides-Extra: all
|
|
20
|
+
Requires-Dist: ray[all]; extra == "all"
|
|
21
|
+
|
|
22
|
+
This is the SDK to develop synapse plugins
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Internationalization
|
|
26
|
+
|
|
27
|
+
### Find Messages
|
|
28
|
+
```bash
|
|
29
|
+
$ find . -name "*.py" | xargs xgettext -o messages.pot
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Make Messages
|
|
33
|
+
```bash
|
|
34
|
+
$ msginit -l ko -i messages.pot -o synapse_sdk/locale/ko/LC_MESSAGES/messages.po
|
|
35
|
+
$ msginit -l en -i messages.pot -o synapse_sdk/locale/en/LC_MESSAGES/messages.po
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Compile Messages
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
$ msgfmt synapse_sdk/locale/ko/LC_MESSAGES/messages.po -o synapse_sdk/locale/ko/LC_MESSAGES/messages.mo
|
|
42
|
+
$ msgfmt synapse_sdk/locale/en/LC_MESSAGES/messages.po -o synapse_sdk/locale/en/LC_MESSAGES/messages.mo
|
|
43
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
This is the SDK to develop synapse plugins
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Internationalization
|
|
5
|
+
|
|
6
|
+
### Find Messages
|
|
7
|
+
```bash
|
|
8
|
+
$ find . -name "*.py" | xargs xgettext -o messages.pot
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Make Messages
|
|
12
|
+
```bash
|
|
13
|
+
$ msginit -l ko -i messages.pot -o synapse_sdk/locale/ko/LC_MESSAGES/messages.po
|
|
14
|
+
$ msginit -l en -i messages.pot -o synapse_sdk/locale/en/LC_MESSAGES/messages.po
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Compile Messages
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
$ msgfmt synapse_sdk/locale/ko/LC_MESSAGES/messages.po -o synapse_sdk/locale/ko/LC_MESSAGES/messages.mo
|
|
21
|
+
$ msgfmt synapse_sdk/locale/en/LC_MESSAGES/messages.po -o synapse_sdk/locale/en/LC_MESSAGES/messages.mo
|
|
22
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
5
|
+
#
|
|
6
|
+
#, fuzzy
|
|
7
|
+
msgid ""
|
|
8
|
+
msgstr ""
|
|
9
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
|
+
"Report-Msgid-Bugs-To: \n"
|
|
11
|
+
"POT-Creation-Date: 2024-11-27 17:16+0900\n"
|
|
12
|
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
15
|
+
"Language: \n"
|
|
16
|
+
"MIME-Version: 1.0\n"
|
|
17
|
+
"Content-Type: text/plain; charset=CHARSET\n"
|
|
18
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
19
|
+
|
|
20
|
+
#: synapse_sdk/utils/debug.py:5
|
|
21
|
+
msgid "hello world from sdk"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: synapse_sdk/plugins/cli/publish.py:34
|
|
25
|
+
msgid "Successfully published \"{}\" ({}) to synapse backend!"
|
|
26
|
+
msgstr ""
|
|
27
|
+
|
|
28
|
+
#: synapse_sdk/plugins/cli/__init__.py:17
|
|
29
|
+
msgid "Debug mode is \"on\""
|
|
30
|
+
msgstr ""
|
|
31
|
+
|
|
32
|
+
#: synapse_sdk/plugins/upload.py:63
|
|
33
|
+
msgid "Building {}..."
|
|
34
|
+
msgstr ""
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from synapse_sdk.clients.agent.core import CoreClientMixin
|
|
2
|
+
from synapse_sdk.clients.agent.ray import RayClientMixin
|
|
3
|
+
from synapse_sdk.clients.agent.service import ServiceClientMixin
|
|
4
|
+
from synapse_sdk.clients.exceptions import ClientError
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AgentClient(CoreClientMixin, RayClientMixin, ServiceClientMixin):
|
|
8
|
+
name = 'Agent'
|
|
9
|
+
agent_token = None
|
|
10
|
+
user_token = None
|
|
11
|
+
tenant = None
|
|
12
|
+
long_poll_handler = None
|
|
13
|
+
|
|
14
|
+
def __init__(self, base_url, agent_token, user_token=None, tenant=None, long_poll_handler=None):
|
|
15
|
+
super().__init__(base_url)
|
|
16
|
+
self.agent_token = agent_token
|
|
17
|
+
self.user_token = user_token
|
|
18
|
+
self.tenant = tenant
|
|
19
|
+
self.long_poll_handler = long_poll_handler
|
|
20
|
+
|
|
21
|
+
def _get_headers(self):
|
|
22
|
+
headers = {'Authorization': self.agent_token}
|
|
23
|
+
if self.user_token:
|
|
24
|
+
headers['SYNAPSE-User'] = f'Token {self.user_token}'
|
|
25
|
+
if self.tenant:
|
|
26
|
+
headers['SYNAPSE-Tenant'] = f'Token {self.tenant}'
|
|
27
|
+
return headers
|
|
28
|
+
|
|
29
|
+
def _request(self, method, path, **kwargs):
|
|
30
|
+
if self.long_poll_handler:
|
|
31
|
+
return self._request_long_poll(method, path, **kwargs)
|
|
32
|
+
return super()._request(method, path, **kwargs)
|
|
33
|
+
|
|
34
|
+
def _request_long_poll(self, method, path, **kwargs):
|
|
35
|
+
headers = self._get_headers()
|
|
36
|
+
|
|
37
|
+
if kwargs.get('files'):
|
|
38
|
+
raise ClientError(400, 'file is not allowed when long polling')
|
|
39
|
+
|
|
40
|
+
headers['Content-Type'] = 'application/json'
|
|
41
|
+
|
|
42
|
+
request_id = self.long_poll_handler.set_request({'method': method, 'path': path, 'headers': headers, **kwargs})
|
|
43
|
+
try:
|
|
44
|
+
response = self.long_poll_handler.get_response(request_id)
|
|
45
|
+
except TimeoutError:
|
|
46
|
+
raise ClientError(408, f'{self.name} is not responding')
|
|
47
|
+
|
|
48
|
+
if 400 <= response['status'] < 600:
|
|
49
|
+
raise ClientError(response['status'], response.json() if response['status'] == 400 else response['reason'])
|
|
50
|
+
|
|
51
|
+
return response['data']
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
from synapse_sdk.clients.base import BaseClient
|
|
2
|
+
from synapse_sdk.clients.exceptions import ClientError
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
class
|
|
5
|
-
def run_plugin_release(self, code, data):
|
|
6
|
-
path = f'plugin_releases/{code}/run/'
|
|
7
|
-
return self._post(path, data=data)
|
|
8
|
-
|
|
9
|
-
def run_debug_plugin_release(self, data):
|
|
10
|
-
path = 'plugin_releases/run_debug/'
|
|
11
|
-
return self._post(path, data=data)
|
|
12
|
-
|
|
13
|
-
def create_plugin_release(self, data):
|
|
14
|
-
path = 'plugin_releases/'
|
|
15
|
-
return self._post(path, data=data)
|
|
16
|
-
|
|
5
|
+
class RayClientMixin(BaseClient):
|
|
17
6
|
def get_job(self, pk):
|
|
18
7
|
path = f'jobs/{pk}/'
|
|
19
8
|
return self._get(path)
|
|
@@ -27,6 +16,9 @@ class ServiceClientMixin(BaseClient):
|
|
|
27
16
|
return self._get(path)
|
|
28
17
|
|
|
29
18
|
def tail_job_logs(self, pk):
|
|
19
|
+
if self.long_poll_handler:
|
|
20
|
+
raise ClientError(400, '"tail_job_logs" does not support long polling')
|
|
21
|
+
|
|
30
22
|
path = f'jobs/{pk}/tail_logs/'
|
|
31
23
|
|
|
32
24
|
url = self._get_url(path)
|
|
@@ -52,3 +44,11 @@ class ServiceClientMixin(BaseClient):
|
|
|
52
44
|
def list_tasks(self):
|
|
53
45
|
path = 'tasks/'
|
|
54
46
|
return self._get(path)
|
|
47
|
+
|
|
48
|
+
def get_serve_application(self, pk):
|
|
49
|
+
path = f'serve_application/{pk}/'
|
|
50
|
+
return self._get(path)
|
|
51
|
+
|
|
52
|
+
def list_serve_applications(self):
|
|
53
|
+
path = 'serve_applications/'
|
|
54
|
+
return self._get(path)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from synapse_sdk.clients.base import BaseClient
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ServiceClientMixin(BaseClient):
|
|
5
|
+
def run_plugin_release(self, code, data):
|
|
6
|
+
path = f'plugin_releases/{code}/run/'
|
|
7
|
+
return self._post(path, data=data)
|
|
8
|
+
|
|
9
|
+
def run_debug_plugin_release(self, data):
|
|
10
|
+
path = 'plugin_releases/run_debug/'
|
|
11
|
+
return self._post(path, data=data)
|
|
12
|
+
|
|
13
|
+
def create_plugin_release(self, data):
|
|
14
|
+
path = 'plugin_releases/'
|
|
15
|
+
return self._post(path, data=data)
|
|
@@ -9,14 +9,15 @@ class BackendClient(AnnotationClientMixin, DatasetClientMixin, IntegrationClient
|
|
|
9
9
|
token = None
|
|
10
10
|
tenant = None
|
|
11
11
|
|
|
12
|
-
def __init__(self, base_url, token, tenant=None):
|
|
12
|
+
def __init__(self, base_url, token=None, tenant=None):
|
|
13
13
|
super().__init__(base_url)
|
|
14
14
|
self.token = token
|
|
15
|
-
|
|
16
|
-
self.tenant = tenant
|
|
15
|
+
self.tenant = tenant
|
|
17
16
|
|
|
18
17
|
def _get_headers(self):
|
|
19
|
-
headers = {
|
|
18
|
+
headers = {}
|
|
19
|
+
if self.token:
|
|
20
|
+
headers = {'Authorization': f'Token {self.token}'}
|
|
20
21
|
if self.tenant:
|
|
21
22
|
headers['SYNAPSE-Tenant'] = f'Token {self.tenant}'
|
|
22
23
|
return headers
|
|
@@ -2,6 +2,10 @@ from synapse_sdk.clients.base import BaseClient
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class IntegrationClientMixin(BaseClient):
|
|
5
|
+
def health_check_agent(self, token):
|
|
6
|
+
path = f'agents/{token}/connect/'
|
|
7
|
+
return self._post(path)
|
|
8
|
+
|
|
5
9
|
def get_plugin(self, pk):
|
|
6
10
|
path = f'plugins/{pk}/'
|
|
7
11
|
return self._get(path)
|
|
@@ -27,6 +31,10 @@ class IntegrationClientMixin(BaseClient):
|
|
|
27
31
|
files = {'file': data.pop('file')}
|
|
28
32
|
return self._post(path, data=data, files=files)
|
|
29
33
|
|
|
34
|
+
def get_job(self, pk, params=None):
|
|
35
|
+
path = f'jobs/{pk}/'
|
|
36
|
+
return self._get(path, params=params)
|
|
37
|
+
|
|
30
38
|
def list_jobs(self, params=None):
|
|
31
39
|
path = 'jobs/'
|
|
32
40
|
return self._get(path, params=params)
|
|
@@ -19,6 +19,10 @@ class MLClientMixin(BaseClient):
|
|
|
19
19
|
files = {'file': data.pop('file')}
|
|
20
20
|
return self._post(path, data=data, files=files)
|
|
21
21
|
|
|
22
|
+
def create_serve_application(self, data):
|
|
23
|
+
path = 'serve_applications/'
|
|
24
|
+
return self._post(path, data=data)
|
|
25
|
+
|
|
22
26
|
def list_ground_truth_events(self, params=None, url_conversion=None, list_all=False):
|
|
23
27
|
path = 'ground_truth_events/'
|
|
24
28
|
url_conversion = get_default_url_conversion(url_conversion, files_fields=['files'])
|
|
@@ -50,7 +50,13 @@ class BaseClient:
|
|
|
50
50
|
except requests.ConnectionError:
|
|
51
51
|
raise ClientError(408, f'{self.name} is not responding')
|
|
52
52
|
|
|
53
|
-
return
|
|
53
|
+
return self._post_response(response)
|
|
54
|
+
|
|
55
|
+
def _post_response(self, response):
|
|
56
|
+
try:
|
|
57
|
+
return response.json()
|
|
58
|
+
except ValueError:
|
|
59
|
+
return response.text
|
|
54
60
|
|
|
55
61
|
def _get(self, path, url_conversion=None, **kwargs):
|
|
56
62
|
response = self._request('get', path, **kwargs)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from synapse_sdk.clients.base import BaseClient
|
|
2
|
+
from synapse_sdk.clients.exceptions import ClientError
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class CoreClientMixin(BaseClient):
|
|
6
|
+
def list_nodes(self, params=None):
|
|
7
|
+
path = 'nodes'
|
|
8
|
+
response = self._get(path, params=params)
|
|
9
|
+
if not response['result']:
|
|
10
|
+
raise ClientError(200, response['msg'])
|
|
11
|
+
return response['data']['summary']
|
|
12
|
+
|
|
13
|
+
def get_node(self, pk, params=None):
|
|
14
|
+
path = f'nodes/{pk}'
|
|
15
|
+
response = self._get(path, params=params)['detail']
|
|
16
|
+
|
|
17
|
+
if not response['result']:
|
|
18
|
+
raise ClientError(200, response['msg'])
|
|
19
|
+
|
|
20
|
+
if 'agent' not in response['data']:
|
|
21
|
+
raise ClientError(404, 'Node Not Found')
|
|
22
|
+
return response['data']
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from synapse_sdk.clients.base import BaseClient
|
|
2
|
+
from synapse_sdk.clients.exceptions import ClientError
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ServeClientMixin(BaseClient):
|
|
6
|
+
def list_serve_applications(self, params=None):
|
|
7
|
+
path = 'api/serve/applications/'
|
|
8
|
+
response = self._get(path, params=params)
|
|
9
|
+
for key, item in response['applications'].items():
|
|
10
|
+
response['applications'][key]['deployments'] = list(item['deployments'].values())
|
|
11
|
+
return list(response['applications'].values())
|
|
12
|
+
|
|
13
|
+
def get_serve_application(self, pk, params=None):
|
|
14
|
+
path = 'api/serve/applications/'
|
|
15
|
+
response = self._get(path, params=params)
|
|
16
|
+
try:
|
|
17
|
+
response['applications'][pk]['deployments'] = list(response['applications'][pk]['deployments'].values())
|
|
18
|
+
return response['applications'][pk]
|
|
19
|
+
except KeyError:
|
|
20
|
+
raise ClientError(404, 'Serve Application Not Found')
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import gettext as _gettext
|
|
2
|
+
import locale
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
ASSIGNED_LOCALE = None
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def set_language(language):
|
|
9
|
+
ASSIGNED_LOCALE = language # noqa: F841
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_locale():
|
|
13
|
+
if ASSIGNED_LOCALE is not None:
|
|
14
|
+
return ASSIGNED_LOCALE
|
|
15
|
+
|
|
16
|
+
system_locale, encoding = locale.getlocale()
|
|
17
|
+
|
|
18
|
+
if system_locale is None:
|
|
19
|
+
system_locale = 'en'
|
|
20
|
+
|
|
21
|
+
return system_locale
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
language = get_locale().split('_')[0]
|
|
25
|
+
|
|
26
|
+
PACKAGE_DIR = Path(__file__).parent
|
|
27
|
+
LOCALE_DIR = PACKAGE_DIR / 'locale'
|
|
28
|
+
|
|
29
|
+
translation = _gettext.translation('messages', localedir=LOCALE_DIR, languages=[language], fallback=True)
|
|
30
|
+
translation.install()
|
|
31
|
+
|
|
32
|
+
gettext = translation.gettext
|
|
33
|
+
ngettext = translation.ngettext
|
|
34
|
+
pgettext = translation.pgettext
|
|
35
|
+
npgettext = translation.npgettext
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# English translations for PACKAGE package.
|
|
2
|
+
# Copyright (C) 2024 THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# <developer@datamaker.io>, 2024.
|
|
5
|
+
#
|
|
6
|
+
msgid ""
|
|
7
|
+
msgstr ""
|
|
8
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
9
|
+
"Report-Msgid-Bugs-To: \n"
|
|
10
|
+
"POT-Creation-Date: 2024-11-27 16:15+0900\n"
|
|
11
|
+
"PO-Revision-Date: 2024-11-27 16:17+0900\n"
|
|
12
|
+
"Last-Translator: <developer@datamaker.io>\n"
|
|
13
|
+
"Language-Team: English\n"
|
|
14
|
+
"Language: en\n"
|
|
15
|
+
"MIME-Version: 1.0\n"
|
|
16
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
17
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
18
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
19
|
+
|
|
20
|
+
#: synapse_sdk/utils/debug.py:5
|
|
21
|
+
msgid "hello world from sdk"
|
|
22
|
+
msgstr "hello world from sdk"
|
|
23
|
+
|
|
24
|
+
#: synapse_sdk/plugins/cli/publish.py:34
|
|
25
|
+
#, python-brace-format
|
|
26
|
+
msgid ""
|
|
27
|
+
"Successfully published \"{plugin_release.name}\" ({plugin_release.code}) to "
|
|
28
|
+
"synapse backend!"
|
|
29
|
+
msgstr ""
|
|
30
|
+
"Successfully published \"{plugin_release.name}\" ({plugin_release.code}) to "
|
|
31
|
+
"synapse backend!"
|
|
32
|
+
|
|
33
|
+
#: synapse_sdk/plugins/cli/__init__.py:15
|
|
34
|
+
msgid "Debug mode is \"on\""
|
|
35
|
+
msgstr "Debug mode is \"on\""
|
|
36
|
+
|
|
37
|
+
#: synapse_sdk/plugins/upload.py:62
|
|
38
|
+
msgid "Building {Path(source_path).name}..."
|
|
39
|
+
msgstr "Building {Path(source_path).name}..."
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Korean translations for PACKAGE package.
|
|
2
|
+
# Copyright (C) 2024 THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# <developer@datamaker.io>, 2024.
|
|
5
|
+
#
|
|
6
|
+
msgid ""
|
|
7
|
+
msgstr ""
|
|
8
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
9
|
+
"Report-Msgid-Bugs-To: \n"
|
|
10
|
+
"POT-Creation-Date: 2024-11-27 17:16+0900\n"
|
|
11
|
+
"PO-Revision-Date: 2024-11-27 17:16+0900\n"
|
|
12
|
+
"Last-Translator: <developer@datamaker.io>\n"
|
|
13
|
+
"Language-Team: Korean <translation-team-ko@googlegroups.com>\n"
|
|
14
|
+
"Language: ko\n"
|
|
15
|
+
"MIME-Version: 1.0\n"
|
|
16
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
17
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
18
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
19
|
+
|
|
20
|
+
#: synapse_sdk/utils/debug.py:5
|
|
21
|
+
msgid "hello world from sdk"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: synapse_sdk/plugins/cli/publish.py:34
|
|
25
|
+
msgid "Successfully published \"{}\" ({}) to synapse backend!"
|
|
26
|
+
msgstr "Synapse 백엔드에 \"{}\" ({})를 성공적으로 등록되었습니다!"
|
|
27
|
+
|
|
28
|
+
#: synapse_sdk/plugins/cli/__init__.py:17
|
|
29
|
+
msgid "Debug mode is \"on\""
|
|
30
|
+
msgstr "디버그 모드가 \"켜짐\" 상태입니다"
|
|
31
|
+
|
|
32
|
+
#: synapse_sdk/plugins/upload.py:63
|
|
33
|
+
msgid "Building {}..."
|
|
34
|
+
msgstr "{} 빌드 중..."
|
|
@@ -99,11 +99,11 @@ class BackendLogger(BaseLogger):
|
|
|
99
99
|
except ClientError:
|
|
100
100
|
pass
|
|
101
101
|
|
|
102
|
-
def log(self,
|
|
103
|
-
print(
|
|
102
|
+
def log(self, event, data):
|
|
103
|
+
print(event, data)
|
|
104
104
|
|
|
105
105
|
log = {
|
|
106
|
-
'
|
|
106
|
+
'event': event,
|
|
107
107
|
'data': data,
|
|
108
108
|
'datetime': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f'),
|
|
109
109
|
'job': self.job_id,
|
|
@@ -8,9 +8,11 @@ import ray
|
|
|
8
8
|
import requests
|
|
9
9
|
from pydantic import ValidationError
|
|
10
10
|
from ray.dashboard.modules.job.sdk import JobSubmissionClient
|
|
11
|
+
from ray.exceptions import RayTaskError
|
|
11
12
|
|
|
13
|
+
from synapse_sdk.clients.ray import RayClient
|
|
12
14
|
from synapse_sdk.plugins.enums import RunMethod
|
|
13
|
-
from synapse_sdk.plugins.exceptions import
|
|
15
|
+
from synapse_sdk.plugins.exceptions import ActionError
|
|
14
16
|
from synapse_sdk.plugins.models import PluginRelease, Run
|
|
15
17
|
from synapse_sdk.plugins.upload import archive_and_upload, build_and_upload, download_and_upload
|
|
16
18
|
from synapse_sdk.utils.module_loading import import_string
|
|
@@ -38,6 +40,7 @@ class Action:
|
|
|
38
40
|
run = None
|
|
39
41
|
|
|
40
42
|
default_envs = [
|
|
43
|
+
'RAY_ADDRESS',
|
|
41
44
|
'RAY_DASHBOARD_URL',
|
|
42
45
|
'RAY_SERVE_ADDRESS',
|
|
43
46
|
'SYNAPSE_PLUGIN_STORAGE',
|
|
@@ -56,7 +59,7 @@ class Action:
|
|
|
56
59
|
self.job_id = job_id
|
|
57
60
|
self.direct = direct
|
|
58
61
|
self.debug = debug
|
|
59
|
-
self.envs = {**
|
|
62
|
+
self.envs = {**self.get_default_envs(), **envs} if envs else self.get_default_envs()
|
|
60
63
|
self.run = self.get_run()
|
|
61
64
|
|
|
62
65
|
@cached_property
|
|
@@ -71,10 +74,14 @@ class Action:
|
|
|
71
74
|
def client(self):
|
|
72
75
|
return self.run.client
|
|
73
76
|
|
|
77
|
+
@property
|
|
78
|
+
def ray_client(self):
|
|
79
|
+
return RayClient(self.envs['RAY_DASHBOARD_URL'])
|
|
80
|
+
|
|
74
81
|
@property
|
|
75
82
|
def plugin_url(self):
|
|
76
83
|
if self.debug:
|
|
77
|
-
plugin_path = self.envs.get('SYNAPSE_DEBUG_PLUGIN_PATH'
|
|
84
|
+
plugin_path = self.envs.get('SYNAPSE_DEBUG_PLUGIN_PATH') or '.'
|
|
78
85
|
if plugin_path.startswith('https://'): # TODO ray에서 지원하는 remote uri 형식 (https, s3, gs) 모두 지원
|
|
79
86
|
plugin_url = plugin_path
|
|
80
87
|
elif plugin_path.startswith('http://'):
|
|
@@ -131,10 +138,14 @@ class Action:
|
|
|
131
138
|
try:
|
|
132
139
|
self.params_model.model_validate(self.params, context={'action': self})
|
|
133
140
|
except ValidationError as e:
|
|
134
|
-
raise
|
|
141
|
+
raise ActionError({'params': pydantic_to_drf_error(e)})
|
|
135
142
|
|
|
136
143
|
def run_action(self):
|
|
137
144
|
self.validate_params()
|
|
145
|
+
|
|
146
|
+
if not ray.is_initialized():
|
|
147
|
+
ray.init(address=self.envs['RAY_ADDRESS'], ignore_reinit_error=True)
|
|
148
|
+
|
|
138
149
|
if self.direct:
|
|
139
150
|
if self.method == RunMethod.RESTAPI:
|
|
140
151
|
return self.start_by_restapi()
|
|
@@ -171,7 +182,11 @@ class Action:
|
|
|
171
182
|
kwargs[param.name] = getattr(self, param.name)
|
|
172
183
|
|
|
173
184
|
kwargs['direct'] = True
|
|
174
|
-
|
|
185
|
+
try:
|
|
186
|
+
return ray.get(run_task.remote(self.category.value, self.name, *args, **kwargs))
|
|
187
|
+
except RayTaskError as e:
|
|
188
|
+
error = e.as_instanceof_cause()
|
|
189
|
+
raise ActionError(error.cause)
|
|
175
190
|
|
|
176
191
|
def start_by_job(self):
|
|
177
192
|
main_options = []
|
|
@@ -186,7 +201,7 @@ class Action:
|
|
|
186
201
|
|
|
187
202
|
cmd = ' '.join(main_options + options + arguments)
|
|
188
203
|
|
|
189
|
-
client =
|
|
204
|
+
client = self.get_job_client()
|
|
190
205
|
return client.submit_job(
|
|
191
206
|
submission_id=self.job_id,
|
|
192
207
|
entrypoint=f'python main.py {cmd}',
|
|
@@ -198,10 +213,24 @@ class Action:
|
|
|
198
213
|
method = self.params.pop('method')
|
|
199
214
|
|
|
200
215
|
url = self.plugin_release.get_serve_url(self.envs['RAY_SERVE_ADDRESS'], path)
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
216
|
+
try:
|
|
217
|
+
response = getattr(requests, method)(url, **self.params)
|
|
218
|
+
try:
|
|
219
|
+
response_body = response.json()
|
|
220
|
+
except ValueError:
|
|
221
|
+
response_body = response.text
|
|
222
|
+
if response.ok:
|
|
223
|
+
return response_body
|
|
224
|
+
else:
|
|
225
|
+
raise ActionError({'status': response.status_code, 'reason': response.reason, 'message': response_body})
|
|
226
|
+
except requests.ConnectionError:
|
|
227
|
+
raise ActionError('Unable to connect to serve application')
|
|
204
228
|
|
|
205
229
|
def post_action_by_job(self, result):
|
|
206
230
|
if self.client:
|
|
207
|
-
self.
|
|
231
|
+
job_client = self.get_job_client()
|
|
232
|
+
logs = job_client.get_job_logs(self.job_id).split('\n')
|
|
233
|
+
self.client.update_job(self.job_id, data={'result': result or {}, 'console_logs': logs})
|
|
234
|
+
|
|
235
|
+
def get_job_client(self):
|
|
236
|
+
return JobSubmissionClient(address=self.envs.get('RAY_DASHBOARD_URL'))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from ray import serve
|
|
2
|
+
|
|
3
|
+
from synapse_sdk.clients.exceptions import ClientError
|
|
4
|
+
from synapse_sdk.plugins.categories.base import Action
|
|
5
|
+
from synapse_sdk.plugins.categories.decorators import register_action
|
|
6
|
+
from synapse_sdk.plugins.enums import PluginCategory, RunMethod
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@register_action
|
|
10
|
+
class DeploymentAction(Action):
|
|
11
|
+
name = 'deployment'
|
|
12
|
+
category = PluginCategory.NEURAL_NET
|
|
13
|
+
method = RunMethod.JOB
|
|
14
|
+
|
|
15
|
+
def get_deployment(self):
|
|
16
|
+
return serve.deployment(ray_actor_options=self.get_actor_options())(self.entrypoint)
|
|
17
|
+
|
|
18
|
+
def get_actor_options(self):
|
|
19
|
+
return {'runtime_env': self.get_runtime_env()}
|
|
20
|
+
|
|
21
|
+
def start(self):
|
|
22
|
+
deployment = self.get_deployment()
|
|
23
|
+
serve.delete(self.plugin_release.code)
|
|
24
|
+
# TODO add run object
|
|
25
|
+
serve.run(deployment.bind(), name=self.plugin_release.code, route_prefix=f'/{self.plugin_release.checksum}')
|
|
26
|
+
|
|
27
|
+
# 백엔드에 ServeApplication 추가
|
|
28
|
+
serve_application = self.create_serve_application()
|
|
29
|
+
return {'serve_application': serve_application['id'] if serve_application else None}
|
|
30
|
+
|
|
31
|
+
def create_serve_application(self):
|
|
32
|
+
if self.client:
|
|
33
|
+
try:
|
|
34
|
+
job = self.client.get_job(self.job_id)
|
|
35
|
+
serve_application = self.ray_client.get_serve_application(self.plugin_release.code)
|
|
36
|
+
return self.client.create_serve_application({
|
|
37
|
+
'plugin': self.plugin_release.plugin,
|
|
38
|
+
'version': self.plugin_release.version,
|
|
39
|
+
'agent': job['agent'],
|
|
40
|
+
'status': serve_application['status'],
|
|
41
|
+
'data': serve_application,
|
|
42
|
+
})
|
|
43
|
+
except ClientError:
|
|
44
|
+
pass
|
|
45
|
+
return None
|