primitive 0.2.8__py3-none-any.whl → 0.2.9__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.
- primitive/__about__.py +1 -1
- primitive/agent/runner.py +45 -8
- primitive/jobs/actions.py +3 -0
- {primitive-0.2.8.dist-info → primitive-0.2.9.dist-info}/METADATA +1 -1
- {primitive-0.2.8.dist-info → primitive-0.2.9.dist-info}/RECORD +8 -8
- {primitive-0.2.8.dist-info → primitive-0.2.9.dist-info}/WHEEL +0 -0
- {primitive-0.2.8.dist-info → primitive-0.2.9.dist-info}/entry_points.txt +0 -0
- {primitive-0.2.8.dist-info → primitive-0.2.9.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/agent/runner.py
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
+
import asyncio
|
1
2
|
import os
|
2
3
|
import re
|
3
|
-
import typing
|
4
4
|
import shutil
|
5
|
-
|
5
|
+
import time
|
6
|
+
import typing
|
6
7
|
from abc import abstractmethod
|
7
|
-
from enum import
|
8
|
+
from enum import Enum, IntEnum
|
8
9
|
from pathlib import Path, PurePath
|
9
|
-
from
|
10
|
+
from typing import Dict, List, TypedDict
|
11
|
+
|
10
12
|
import yaml
|
11
|
-
import
|
12
|
-
|
13
|
-
from ..utils.cache import get_artifacts_cache,
|
13
|
+
from loguru import logger
|
14
|
+
|
15
|
+
from ..utils.cache import get_artifacts_cache, get_logs_cache, get_sources_cache
|
14
16
|
from ..utils.shell import env_to_dict
|
15
17
|
|
16
18
|
try:
|
@@ -168,10 +170,45 @@ class Runner:
|
|
168
170
|
else:
|
169
171
|
logger.success(f"Completed {self.job['slug']} job")
|
170
172
|
|
173
|
+
number_of_files_produced = self.get_number_of_files_produced()
|
174
|
+
logger.info(
|
175
|
+
f"Produced {number_of_files_produced} files for {self.job['slug']} job"
|
176
|
+
)
|
171
177
|
self.primitive.jobs.job_run_update(
|
172
|
-
self.job_run["id"],
|
178
|
+
self.job_run["id"],
|
179
|
+
status="request_completed",
|
180
|
+
conclusion=conclusion,
|
181
|
+
number_of_files_produced=number_of_files_produced,
|
173
182
|
)
|
174
183
|
|
184
|
+
def get_number_of_files_produced(self) -> int:
|
185
|
+
"""Returns the number of files produced by the job."""
|
186
|
+
number_of_files_produced = 0
|
187
|
+
|
188
|
+
# Logs can be produced even if no artifact stores are created for the job run.
|
189
|
+
job_run_logs_cache = get_logs_cache(self.job_run["id"])
|
190
|
+
log_files = [
|
191
|
+
file
|
192
|
+
for _, _, current_path_files in job_run_logs_cache.walk()
|
193
|
+
for file in current_path_files
|
194
|
+
]
|
195
|
+
|
196
|
+
number_of_files_produced += len(log_files)
|
197
|
+
|
198
|
+
if "stores" not in self.config:
|
199
|
+
return number_of_files_produced
|
200
|
+
|
201
|
+
job_run_artifacts_cache = get_artifacts_cache(self.job_run["id"])
|
202
|
+
artifact_files = [
|
203
|
+
file
|
204
|
+
for _, _, current_path_files in job_run_artifacts_cache.walk()
|
205
|
+
for file in current_path_files
|
206
|
+
]
|
207
|
+
|
208
|
+
number_of_files_produced += len(artifact_files)
|
209
|
+
|
210
|
+
return number_of_files_produced
|
211
|
+
|
175
212
|
async def run_task(self, task: Task) -> bool:
|
176
213
|
for cmd in task["cmd"].strip().split("\n"):
|
177
214
|
# Adding an additional echo and utilizing stdbuf to force line buffering
|
primitive/jobs/actions.py
CHANGED
@@ -113,6 +113,7 @@ class Jobs(BaseAction):
|
|
113
113
|
status: str = None,
|
114
114
|
conclusion: str = None,
|
115
115
|
file_ids: Optional[List[str]] = [],
|
116
|
+
number_of_files_produced: Optional[int] = None,
|
116
117
|
):
|
117
118
|
mutation = gql(job_run_update_mutation)
|
118
119
|
input = {"id": id}
|
@@ -122,6 +123,8 @@ class Jobs(BaseAction):
|
|
122
123
|
input["conclusion"] = conclusion
|
123
124
|
if file_ids and len(file_ids) > 0:
|
124
125
|
input["files"] = file_ids
|
126
|
+
if number_of_files_produced is not None:
|
127
|
+
input["numberOfFilesProduced"] = number_of_files_produced
|
125
128
|
variables = {"input": input}
|
126
129
|
result = self.primitive.session.execute(
|
127
130
|
mutation, variable_values=variables, get_execution_result=True
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.9
|
4
4
|
Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
|
5
5
|
Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
|
6
6
|
Project-URL: Source, https://github.com//primitivecorp/primitive-cli
|
@@ -1,11 +1,11 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=V16ToyYKX_TkMalQ8iZqJDttwNhendnTztxFcipRvkM,129
|
2
2
|
primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
|
3
3
|
primitive/cli.py,sha256=58fn6ayVSC1f4hLKx3FUNT9CkuPLva8dFQg0_YUwpio,2410
|
4
4
|
primitive/client.py,sha256=PPyIQRvKKSqCF9RRF5mJJ4Vqqolpzy1YXqffNLKIvAA,2390
|
5
5
|
primitive/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
primitive/agent/actions.py,sha256=5Lmqxsf24eH6BDEesbJbn1Xj-8ifVlQ_Y3QR8xpkFtM,6869
|
7
7
|
primitive/agent/commands.py,sha256=-dVDilELfkGfbZB7qfEPs77Dm1oT62qJj4tsIk4KoxI,254
|
8
|
-
primitive/agent/runner.py,sha256=
|
8
|
+
primitive/agent/runner.py,sha256=NQeJFVEZrUFdwdn4NWzcbIF-vnWHiVeVp5pblH6yVgQ,13329
|
9
9
|
primitive/agent/uploader.py,sha256=6pjUyb1LyUCpHBE6p13pRpXxy6iDxu14qJGvE3R6cVo,3155
|
10
10
|
primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
primitive/auth/actions.py,sha256=MPsG9LcKcOPwA7gZ9Ewk0PZJhTQvIrGfODdz4GxSzgA,999
|
@@ -46,7 +46,7 @@ primitive/hardware/graphql/fragments.py,sha256=kI6qnTNjaEaUr-C6eD55COphtueVYbYOW
|
|
46
46
|
primitive/hardware/graphql/mutations.py,sha256=_4Hkbfik9Ron4T-meulu6T-9FR_BZjyPNwn745MPksU,1484
|
47
47
|
primitive/hardware/graphql/queries.py,sha256=I86uLuOSjHSph11Y5MVCYko5Js7hoiEZ-cEoPTc4J-k,1392
|
48
48
|
primitive/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
|
-
primitive/jobs/actions.py,sha256=
|
49
|
+
primitive/jobs/actions.py,sha256=lOfmjzZ7XvqLyP0f-ilyfYwQQZuNgUb4qxFCpf1d93M,5076
|
50
50
|
primitive/jobs/commands.py,sha256=MxPCkBEYW_eLNqgCRYeyj7ZcLOFAWfpVZlqDR2Y_S0o,830
|
51
51
|
primitive/jobs/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
52
|
primitive/jobs/graphql/fragments.py,sha256=1_ZttT7dx36KDC3DClJz9M8LMpsPwXySBygHSiUEcGg,619
|
@@ -88,8 +88,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
|
|
88
88
|
primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
|
89
89
|
primitive/utils/shell.py,sha256=jWzb7ky7p987dJas6ZvarK3IJNZ5cwBXcryRWb9Uh6U,2072
|
90
90
|
primitive/utils/text.py,sha256=XiESMnlhjQ534xE2hMNf08WehE1SKaYFRNih0MmnK0k,829
|
91
|
-
primitive-0.2.
|
92
|
-
primitive-0.2.
|
93
|
-
primitive-0.2.
|
94
|
-
primitive-0.2.
|
95
|
-
primitive-0.2.
|
91
|
+
primitive-0.2.9.dist-info/METADATA,sha256=ryhKmpz0GrqIcm7mwytK-iMH8SvGdaGTtX4NbROgYr4,3669
|
92
|
+
primitive-0.2.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
primitive-0.2.9.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
94
|
+
primitive-0.2.9.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
95
|
+
primitive-0.2.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|