oceanprotocol-job-details 0.3.10__py3-none-any.whl → 0.3.12__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.
- oceanprotocol_job_details/__init__.py +2 -1
- oceanprotocol_job_details/executors.py +24 -0
- oceanprotocol_job_details/ocean.py +1 -1
- {oceanprotocol_job_details-0.3.10.dist-info → oceanprotocol_job_details-0.3.12.dist-info}/METADATA +1 -1
- {oceanprotocol_job_details-0.3.10.dist-info → oceanprotocol_job_details-0.3.12.dist-info}/RECORD +7 -7
- oceanprotocol_job_details/executers.py +0 -13
- {oceanprotocol_job_details-0.3.10.dist-info → oceanprotocol_job_details-0.3.12.dist-info}/WHEEL +0 -0
- {oceanprotocol_job_details-0.3.10.dist-info → oceanprotocol_job_details-0.3.12.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from .helpers import create_container, load_job_details
|
|
2
2
|
from .ocean import JobDetails
|
|
3
|
+
from .executors import run_in_executor
|
|
3
4
|
|
|
4
|
-
__all__ = [JobDetails, load_job_details, create_container] # type: ignore
|
|
5
|
+
__all__ = [JobDetails, load_job_details, create_container, run_in_executor] # type: ignore
|
|
@@ -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
|
|
{oceanprotocol_job_details-0.3.10.dist-info → oceanprotocol_job_details-0.3.12.dist-info}/METADATA
RENAMED
|
@@ -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
|
{oceanprotocol_job_details-0.3.10.dist-info → oceanprotocol_job_details-0.3.12.dist-info}/RECORD
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
oceanprotocol_job_details/__init__.py,sha256=
|
|
1
|
+
oceanprotocol_job_details/__init__.py,sha256=sq_C8Ey4_4oHiX9cO1wne7ZsWqs86WWgHfKQ5PMwwak,218
|
|
2
2
|
oceanprotocol_job_details/di.py,sha256=H4_n9NrNuRB2s9uarSkwDYzjD1i7sV8dySRfHt21QWM,1316
|
|
3
3
|
oceanprotocol_job_details/domain.py,sha256=ifw-hKFAJj0Gl_wJuH-51LQx4KPsCyEVDsT10xg9uBw,3842
|
|
4
|
-
oceanprotocol_job_details/
|
|
4
|
+
oceanprotocol_job_details/executors.py,sha256=v7VjtAW8yawk9mF1TgU3fF73JBk4l9UasP7egfn7xhc,576
|
|
5
5
|
oceanprotocol_job_details/helpers.py,sha256=ABm3oIRwPd-4XeCOIszCbfL2wkUJqVJJ2bqy3hR4jyw,1064
|
|
6
|
-
oceanprotocol_job_details/ocean.py,sha256=
|
|
6
|
+
oceanprotocol_job_details/ocean.py,sha256=ybpBqMKKqnB2Oyc2XNeay5EpdH041w9fH1chM8hrHxY,1514
|
|
7
7
|
oceanprotocol_job_details/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
oceanprotocol_job_details/settings.py,sha256=o_1Hn2vl5hMk7bAkdS7GjE4nKOAyHm7dScO2_o2sPuY,1345
|
|
9
9
|
oceanprotocol_job_details/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -12,7 +12,7 @@ oceanprotocol_job_details/loaders/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
|
|
|
12
12
|
oceanprotocol_job_details/loaders/impl/ddo.py,sha256=XthrQFhmP85XSVzVjBlLePtTowGR3BAsmVp3jngiQ08,668
|
|
13
13
|
oceanprotocol_job_details/loaders/impl/files.py,sha256=Y2vFBT2T9w9zrdpmf550-LQJxwtNPUGa0UU6bBzk9AU,1145
|
|
14
14
|
oceanprotocol_job_details/loaders/impl/job_details.py,sha256=QwlUaG9KozkI1wX66oDTPg4TjGkvSsi8O-TctF6eWvo,724
|
|
15
|
-
oceanprotocol_job_details-0.3.
|
|
16
|
-
oceanprotocol_job_details-0.3.
|
|
17
|
-
oceanprotocol_job_details-0.3.
|
|
18
|
-
oceanprotocol_job_details-0.3.
|
|
15
|
+
oceanprotocol_job_details-0.3.12.dist-info/METADATA,sha256=9XXhPa3sGMWiSFHOqayYU7xd4su_otGnaCrtjYfZWb8,4495
|
|
16
|
+
oceanprotocol_job_details-0.3.12.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
17
|
+
oceanprotocol_job_details-0.3.12.dist-info/licenses/LICENSE,sha256=ni3ix7P_GxK1W3VGC4fJ3o6QoCngCEpSuTJwO4nkpbw,1055
|
|
18
|
+
oceanprotocol_job_details-0.3.12.dist-info/RECORD,,
|
|
@@ -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)
|
{oceanprotocol_job_details-0.3.10.dist-info → oceanprotocol_job_details-0.3.12.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|