datatorch 0.7.2__tar.gz → 0.7.3__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.
Files changed (110) hide show
  1. {datatorch-0.7.2 → datatorch-0.7.3}/PKG-INFO +1 -1
  2. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/client.py +19 -19
  3. datatorch-0.7.3/datatorch/agent/pipelines/runner/python.py +32 -0
  4. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/runner/shell.py +10 -3
  5. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/client.py +1 -1
  6. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/agent/create.py +5 -5
  7. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch.egg-info/PKG-INFO +1 -1
  8. {datatorch-0.7.2 → datatorch-0.7.3}/setup.py +1 -1
  9. datatorch-0.7.2/datatorch/agent/pipelines/runner/python.py +0 -30
  10. {datatorch-0.7.2 → datatorch-0.7.3}/README.md +0 -0
  11. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/__init__.py +0 -0
  12. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/__init__.py +0 -0
  13. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/agent.py +0 -0
  14. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/directory.py +0 -0
  15. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/log_handler.py +0 -0
  16. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/logging.py +0 -0
  17. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/monitoring.py +0 -0
  18. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/__init__.py +0 -0
  19. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/action/__init__.py +0 -0
  20. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/action/action.py +0 -0
  21. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/action/cache.py +0 -0
  22. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/action/config.py +0 -0
  23. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/job/__init__.py +0 -0
  24. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/job/job.py +0 -0
  25. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/pipeline.py +0 -0
  26. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/resolver.py +0 -0
  27. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/runner/__init__.py +0 -0
  28. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/runner/command.py +0 -0
  29. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/runner/docker.py +0 -0
  30. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/runner/factory.py +0 -0
  31. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/runner/node.py +0 -0
  32. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/runner/runner.py +0 -0
  33. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/step/__init__.py +0 -0
  34. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/step/step.py +0 -0
  35. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/pipelines/template.py +0 -0
  36. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/services/__init__.py +0 -0
  37. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/utils/__init__.py +0 -0
  38. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/utils/docker.py +0 -0
  39. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/agent/utils/process.py +0 -0
  40. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/__init__.py +0 -0
  41. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/api.py +0 -0
  42. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/__init__.py +0 -0
  43. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/annotation.py +0 -0
  44. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/base.py +0 -0
  45. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/dataset.py +0 -0
  46. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/file.py +0 -0
  47. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/label.py +0 -0
  48. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/project.py +0 -0
  49. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/settings.py +0 -0
  50. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/sources/__init__.py +0 -0
  51. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/sources/image/__init__.py +0 -0
  52. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/sources/image/bounding_box.py +0 -0
  53. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/sources/image/segmentations.py +0 -0
  54. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/sources/image/typings.py +0 -0
  55. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/sources/source.py +0 -0
  56. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/storage_link.py +0 -0
  57. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/entity/user.py +0 -0
  58. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/pull.py +0 -0
  59. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/scripts/__init__.py +0 -0
  60. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/scripts/import_coco.py +0 -0
  61. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/scripts/import_pixmask.py +0 -0
  62. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/scripts/utils/__init__.py +0 -0
  63. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/scripts/utils/simplify.py +0 -0
  64. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/utils.py +0 -0
  65. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/api/where.py +0 -0
  66. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/__init__.py +0 -0
  67. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/action/__init__.py +0 -0
  68. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/action/create.py +0 -0
  69. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/action/pull.py +0 -0
  70. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/action/run.py +0 -0
  71. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/agent/__init__.py +0 -0
  72. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/agent/dir.py +0 -0
  73. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/agent/start.py +0 -0
  74. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/groups.py +0 -0
  75. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/import_cmds/__init__.py +0 -0
  76. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/import_cmds/coco.py +0 -0
  77. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/import_cmds/pixmask.py +0 -0
  78. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/main/__init__.py +0 -0
  79. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/main/login.py +0 -0
  80. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/main/logout.py +0 -0
  81. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/main/pull.py +0 -0
  82. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/main/upgrade.py +0 -0
  83. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/main/version.py +0 -0
  84. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/pipeline/__init__.py +0 -0
  85. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/pipeline/generate.py +0 -0
  86. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/pipeline/run.py +0 -0
  87. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/pipeline/upload.py +0 -0
  88. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/spinner.py +0 -0
  89. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/upload/__init__.py +0 -0
  90. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/upload/folder.py +0 -0
  91. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/cli/utils.py +0 -0
  92. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/core/__init__.py +0 -0
  93. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/core/env.py +0 -0
  94. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/core/folder.py +0 -0
  95. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/core/settings.py +0 -0
  96. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/__init__.py +0 -0
  97. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/converters.py +0 -0
  98. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/files.py +0 -0
  99. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/hash_table.py +0 -0
  100. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/objects.py +0 -0
  101. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/package.py +0 -0
  102. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/string_style.py +0 -0
  103. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch/utils/url.py +0 -0
  104. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch.egg-info/SOURCES.txt +0 -0
  105. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch.egg-info/dependency_links.txt +0 -0
  106. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch.egg-info/entry_points.txt +0 -0
  107. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch.egg-info/not-zip-safe +0 -0
  108. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch.egg-info/requires.txt +0 -0
  109. {datatorch-0.7.2 → datatorch-0.7.3}/datatorch.egg-info/top_level.txt +0 -0
  110. {datatorch-0.7.2 → datatorch-0.7.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datatorch
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: A CLI and library for interacting with DataTorch.
5
5
  Home-page: https://github.com/datatorch/python
6
6
  Author: DataTorch
@@ -15,14 +15,14 @@ class Log(TypedDict):
15
15
 
16
16
 
17
17
  class AgentStepDispatch(TypedDict):
18
- """A ready step pushed to this agent (agent protocol v2).
18
+ """A ready step pushed to this runner (runner protocol v2).
19
19
 
20
20
  ``input`` arrives server-resolved: ``steps.*`` and ``input.*``
21
21
  references are already substituted with concrete values.
22
22
  """
23
23
 
24
24
  stepId: str
25
- agentId: str
25
+ runnerId: str
26
26
  action: str
27
27
  stepName: Optional[str]
28
28
  stepIndex: int
@@ -40,10 +40,10 @@ class AgentStepRequest(TypedDict):
40
40
 
41
41
 
42
42
  class AgentStepCancel(TypedDict):
43
- """A stop signal for a step this agent is currently running."""
43
+ """A stop signal for a step this runner is currently running."""
44
44
 
45
45
  stepId: str
46
- agentId: str
46
+ runnerId: str
47
47
 
48
48
 
49
49
  class AgentStepCancelRequest(TypedDict):
@@ -52,7 +52,7 @@ class AgentStepCancelRequest(TypedDict):
52
52
 
53
53
  STEP_DISPATCH_FIELDS = """
54
54
  stepId
55
- agentId
55
+ runnerId
56
56
  action
57
57
  stepName
58
58
  stepIndex
@@ -71,11 +71,11 @@ class AgentApiClient(object):
71
71
  self.session = session
72
72
 
73
73
  def agent_steps(self):
74
- """Subscribe to ready steps dispatched to this agent."""
74
+ """Subscribe to ready steps dispatched to this runner."""
75
75
  # fmt: off
76
76
  sub = gql("""
77
77
  subscription {
78
- step: agentSteps {
78
+ step: runnerSteps {
79
79
  %s
80
80
  }
81
81
  }
@@ -84,7 +84,7 @@ class AgentApiClient(object):
84
84
  return cast(AsyncGenerator[AgentStepRequest, None], self.session.subscribe(sub))
85
85
 
86
86
  def agent_step_cancels(self):
87
- """Subscribe to stop signals for steps this agent is running.
87
+ """Subscribe to stop signals for steps this runner is running.
88
88
 
89
89
  Best effort: the server has already moved the step terminal, so a
90
90
  missed signal only means the step runs to harmless completion.
@@ -92,9 +92,9 @@ class AgentApiClient(object):
92
92
  # fmt: off
93
93
  sub = gql("""
94
94
  subscription {
95
- cancel: agentStepCancels {
95
+ cancel: runnerStepCancels {
96
96
  stepId
97
- agentId
97
+ runnerId
98
98
  }
99
99
  }
100
100
  """)
@@ -105,7 +105,7 @@ class AgentApiClient(object):
105
105
  )
106
106
 
107
107
  async def pending_steps(self) -> List[AgentStepDispatch]:
108
- """Steps dispatched to this agent but not yet claimed.
108
+ """Steps dispatched to this runner but not yet claimed.
109
109
 
110
110
  Called on (re)connect: pushes missed while offline are recovered
111
111
  here.
@@ -113,7 +113,7 @@ class AgentApiClient(object):
113
113
  # fmt: off
114
114
  query = """
115
115
  query PendingSteps {
116
- steps: agentPendingSteps {
116
+ steps: runnerPendingSteps {
117
117
  %s
118
118
  }
119
119
  }
@@ -163,7 +163,7 @@ class AgentApiClient(object):
163
163
  def initial_metrics(self, metrics):
164
164
  # fmt: off
165
165
  mutate = """
166
- mutation updateAgent(
166
+ mutation updateRunner(
167
167
  $id: ID!
168
168
  $version: String
169
169
  $os: String
@@ -177,7 +177,7 @@ class AgentApiClient(object):
177
177
  $cpuCoresPhysical: Int
178
178
  $cpuCoresLogical: Int
179
179
  ) {
180
- updateAgent(id: $id, input: {
180
+ updateRunner(id: $id, input: {
181
181
  version: $version
182
182
  os: $os
183
183
  osRelease: $osRelease
@@ -201,8 +201,8 @@ class AgentApiClient(object):
201
201
  def metrics(self, metrics):
202
202
  # fmt: off
203
203
  mutate = """
204
- mutation updateAgent(
205
- $agentId: ID!
204
+ mutation createRunnerMetric(
205
+ $runnerId: ID!
206
206
  $sampledAt: DateTime!
207
207
  $avgLoad1: Float
208
208
  $avgLoad5: Float
@@ -211,8 +211,8 @@ class AgentApiClient(object):
211
211
  $diskUsage: Float
212
212
  $memoryUsage: Float
213
213
  ) {
214
- createAgentMetric(input: {
215
- agentId: $agentId
214
+ createRunnerMetric(input: {
215
+ runnerId: $runnerId
216
216
  sampledAt: $sampledAt
217
217
  avgLoad1: $avgLoad1
218
218
  avgLoad5: $avgLoad5
@@ -226,7 +226,7 @@ class AgentApiClient(object):
226
226
  }
227
227
  """
228
228
  # fmt: on
229
- params = {"agentId": agent_directory.settings.agent_id, **metrics}
229
+ params = {"runnerId": agent_directory.settings.agent_id, **metrics}
230
230
  return self.execute(mutate, params=params)
231
231
 
232
232
  def upload_step_logs(self, step_id: str, logs: List[Log]):
@@ -0,0 +1,32 @@
1
+ import os
2
+ import sys
3
+ import json
4
+ import shlex
5
+
6
+ from .runner import Runner
7
+
8
+
9
+ class PythonFailedError(Exception):
10
+ pass
11
+
12
+
13
+ class PythonRunner(Runner):
14
+ def __init__(self, *args, **kwargs):
15
+ super().__init__(*args, **kwargs)
16
+ if self.config.get("main") is None:
17
+ raise ValueError("A main path was not provided.")
18
+
19
+ async def execute(self):
20
+ main = self.get("main").strip("/")
21
+ main_path = os.path.join(self.action.dir, main)
22
+
23
+ # Inputs reach the action verbatim as one JSON argv argument.
24
+ # shlex.quote covers every shell metacharacter, apostrophes
25
+ # included, and the space in macOS "Application Support" paths.
26
+ json_input = json.dumps(self.variables.inputs)
27
+
28
+ await self.monitor_cmd(
29
+ " ".join(
30
+ shlex.quote(part) for part in (sys.executable, main_path, json_input)
31
+ )
32
+ )
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import shlex
2
3
 
3
4
  from .runner import Runner
4
5
 
@@ -18,6 +19,12 @@ class ShellRunner(Runner):
18
19
  # ${{ input.* }} — injection policy). Inputs reach the script as
19
20
  # $INPUT_<NAME> environment variables.
20
21
  script = self.get_command("script").strip("/")
21
- script_command = os.path.join(self.action.dir, script)
22
- await self.run_cmd("chmod +x {}".format(script_command.split(" ", 1)[0]))
23
- await self.monitor_cmd(script_command, env=self.input_env())
22
+ # `script` may carry arguments after the path ("run.sh --flag");
23
+ # only the path is joined to the action dir and quoted, since the
24
+ # dir can contain a space (macOS "Application Support").
25
+ script_path, _, script_args = script.partition(" ")
26
+ quoted_path = shlex.quote(os.path.join(self.action.dir, script_path))
27
+ await self.run_cmd(f"chmod +x {quoted_path}")
28
+ await self.monitor_cmd(
29
+ f"{quoted_path} {script_args}".rstrip(), env=self.input_env()
30
+ )
@@ -20,7 +20,7 @@ T = TypeVar("T")
20
20
  __all__ = "Client"
21
21
 
22
22
 
23
- AGENT_TOKEN_HEADER = "datatorch-agent-token"
23
+ AGENT_TOKEN_HEADER = "datatorch-runner-token"
24
24
  API_KEY_HEADER = "datatorch-api-key"
25
25
 
26
26
 
@@ -14,9 +14,9 @@ def create_agent(name: str) -> dict:
14
14
  # fmt: off
15
15
  results = api.execute(
16
16
  """
17
- mutation CreateAgent($name: String!, $version: String!) {
18
- createAgent(name: $name, version: $version) {
19
- agent {
17
+ mutation CreateRunner($name: String!, $version: String!) {
18
+ createRunner(name: $name, version: $version) {
19
+ runner {
20
20
  id
21
21
  }
22
22
  token
@@ -54,8 +54,8 @@ def create(ctx):
54
54
  spinner = Spinner("Creating runner")
55
55
 
56
56
  try:
57
- agent = create_agent(name)["createAgent"]
58
- agent_settings.agent_id = agent["agent"]["id"]
57
+ agent = create_agent(name)["createRunner"]
58
+ agent_settings.agent_id = agent["runner"]["id"]
59
59
  agent_settings.agent_token = agent["token"]
60
60
  agent_settings.api_url = user_settings.api_url
61
61
  except Exception as ex:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datatorch
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: A CLI and library for interacting with DataTorch.
5
5
  Home-page: https://github.com/datatorch/python
6
6
  Author: DataTorch
@@ -33,7 +33,7 @@ requirements = [
33
33
 
34
34
  setup(
35
35
  name="datatorch",
36
- version="0.7.2",
36
+ version="0.7.3",
37
37
  description="A CLI and library for interacting with DataTorch.",
38
38
  author="DataTorch",
39
39
  author_email="support@datatorch.io",
@@ -1,30 +0,0 @@
1
- import os
2
- import sys
3
- import json
4
- import base64
5
-
6
- from .runner import Runner
7
-
8
-
9
- class PythonFailedError(Exception):
10
- pass
11
-
12
-
13
- class PythonRunner(Runner):
14
- def __init__(self, *args, **kwargs):
15
- super().__init__(*args, **kwargs)
16
- if self.config.get("main") is None:
17
- raise ValueError("A main path was not provided.")
18
-
19
- async def execute(self):
20
- main = self.get("main").strip("/")
21
- # Ok this command parsing stuff is to handle Application Support folder in Macs
22
- # Because there are spaces in the folder name
23
- main_command_spaces = os.path.join(self.action.dir, main)
24
- main_command_nospaces = main_command_spaces.replace(" ", "\ ")
25
-
26
- json_input = json.dumps(self.variables.inputs).replace("'", '\\"')
27
-
28
- await self.monitor_cmd(
29
- f"{sys.executable} {main_command_nospaces} '{json_input}'"
30
- )
File without changes
File without changes