oceanprotocol-job-details 0.3.11__tar.gz → 0.3.12__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.
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/PKG-INFO +1 -1
- oceanprotocol_job_details-0.3.12/oceanprotocol_job_details/executors.py +24 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/ocean.py +1 -1
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/pyproject.toml +1 -1
- oceanprotocol_job_details-0.3.11/oceanprotocol_job_details/executors.py +0 -13
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/.gitignore +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/LICENSE +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/README.md +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/__init__.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/di.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/domain.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/helpers.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/loaders/__init__.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/loaders/impl/__init__.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/loaders/impl/ddo.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/loaders/impl/files.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/loaders/impl/job_details.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/loaders/loader.py +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/py.typed +0 -0
- {oceanprotocol_job_details-0.3.11 → oceanprotocol_job_details-0.3.12}/oceanprotocol_job_details/settings.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oceanprotocol-job-details
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.12
|
|
4
4
|
Summary: A Python package to get details from OceanProtocol jobs
|
|
5
5
|
Project-URL: Homepage, https://github.com/AgrospAI/oceanprotocol-job-details
|
|
6
6
|
Project-URL: Issues, https://github.com/AgrospAI/oceanprotocol-job-details/issues
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import inspect
|
|
3
|
+
from typing import Any, Callable, Coroutine, TypeVar
|
|
4
|
+
|
|
5
|
+
T = TypeVar("T")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def run_in_executor(obj: Callable[..., Any] | Coroutine[Any, Any, T]) -> T:
|
|
9
|
+
if callable(obj) and not inspect.iscoroutinefunction(obj):
|
|
10
|
+
return obj()
|
|
11
|
+
|
|
12
|
+
if inspect.iscoroutinefunction(obj):
|
|
13
|
+
obj = obj()
|
|
14
|
+
|
|
15
|
+
if not inspect.iscoroutine(obj):
|
|
16
|
+
return obj
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
loop = asyncio.get_running_loop()
|
|
20
|
+
except RuntimeError:
|
|
21
|
+
return asyncio.run(obj)
|
|
22
|
+
|
|
23
|
+
future = asyncio.run_coroutine_threadsafe(obj, loop)
|
|
24
|
+
return future.result()
|
|
@@ -9,7 +9,7 @@ import aiofiles
|
|
|
9
9
|
from pydantic import BaseModel, ConfigDict, Secret
|
|
10
10
|
|
|
11
11
|
from oceanprotocol_job_details.domain import DDO, Files, Paths
|
|
12
|
-
from oceanprotocol_job_details.
|
|
12
|
+
from oceanprotocol_job_details.executors import run_in_executor
|
|
13
13
|
|
|
14
14
|
InputParametersT = TypeVar("InputParametersT", BaseModel, None)
|
|
15
15
|
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
from typing import Coroutine, TypeVar
|
|
3
|
-
|
|
4
|
-
T = TypeVar("T")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def run_in_executor(coro: Coroutine[None, None, T]) -> T:
|
|
8
|
-
try:
|
|
9
|
-
loop = asyncio.get_running_loop()
|
|
10
|
-
except RuntimeError:
|
|
11
|
-
return asyncio.run(coro)
|
|
12
|
-
else:
|
|
13
|
-
return loop.run_until_complete(coro)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|