primitive 0.2.4__py3-none-any.whl → 0.2.6__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Dylan Stein <dylan@primitive.tech>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.2.4"
4
+ __version__ = "0.2.6"
primitive/agent/runner.py CHANGED
@@ -72,7 +72,7 @@ class Runner:
72
72
  self.job_run = job_run
73
73
  self.job_settings = job_run["jobSettings"]
74
74
  self.config = None
75
- self.source_dir = None
75
+ self.source_dir: Path = None
76
76
  self.initial_env = {}
77
77
  self.modified_env = {}
78
78
  self.file_logger = None
@@ -207,9 +207,14 @@ class Runner:
207
207
  return True
208
208
 
209
209
  if returncode > 0 or stdout_failed or stderr_failed:
210
+ import time
211
+
212
+ start_time = time.monotonic()
210
213
  await self.primitive.jobs.ajob_run_update(
211
214
  self.job_run["id"], status="request_completed", conclusion="failure"
212
215
  )
216
+ end_time = time.monotonic()
217
+ logger.warning(f"JOB RUN UPDATE {end_time - start_time:.2f} seconds")
213
218
 
214
219
  if returncode > 0:
215
220
  logger.error(
@@ -300,7 +305,13 @@ class Runner:
300
305
 
301
306
  async def monitor_cmd(self, process) -> bool:
302
307
  while process.returncode is None:
308
+ import time
309
+
310
+ start_time = time.monotonic()
303
311
  status = await self.primitive.jobs.aget_job_status(self.job_run["id"])
312
+ end_time = time.monotonic()
313
+ logger.warning(f"GET JOB STATUS {end_time - start_time:.2f} seconds")
314
+
304
315
  status_value = status.data["jobRun"]["status"]
305
316
  conclusion_value = status.data["jobRun"]["conclusion"]
306
317
 
@@ -324,20 +335,14 @@ class Runner:
324
335
  return
325
336
 
326
337
  for glob in self.config["stores"]:
327
- path = Path(glob)
328
-
329
- if path.is_dir():
330
- files = [str(f) for f in path.rglob("*") if f.is_file()]
331
- else:
332
- files = [str(f) for f in Path().glob(glob) if f.is_file()]
333
-
334
- for file in files:
335
- relative_path = PurePath(file).relative_to(self.source_dir)
336
- destination = Path(
337
- get_artifacts_cache(self.job_run["id"]) / relative_path
338
- )
339
- destination.parent.mkdir(parents=True, exist_ok=True)
340
- Path(file).replace(destination)
338
+ # Glob relative to the source directory
339
+ matches = self.source_dir.rglob(glob)
340
+
341
+ for match in matches:
342
+ relative_path = PurePath(match).relative_to(self.source_dir)
343
+ dest = Path(get_artifacts_cache(self.job_run["id"]) / relative_path)
344
+ dest.parent.mkdir(parents=True, exist_ok=True)
345
+ Path(match).replace(dest)
341
346
 
342
347
  shutil.rmtree(path=self.source_dir)
343
348
 
@@ -45,10 +45,16 @@ class Uploader:
45
45
  )
46
46
 
47
47
  for file in files:
48
- result = self.primitive.files.upload_file_direct(
49
- path=file,
50
- key_prefix=str(PurePath(file).relative_to(cache.parent).parent),
51
- )
48
+ try:
49
+ result = self.primitive.files.upload_file_direct(
50
+ path=file,
51
+ key_prefix=str(PurePath(file).relative_to(cache.parent).parent),
52
+ )
53
+ except Exception as e:
54
+ if "is empty" in str(e):
55
+ logger.warning(f"{file} is empty, skipping upload")
56
+ continue
57
+
52
58
  upload_id = result.data["fileUpdate"]["id"]
53
59
 
54
60
  if upload_id:
primitive/graphql/sdk.py CHANGED
@@ -30,6 +30,7 @@ def create_session(
30
30
  session = Client(
31
31
  transport=transport,
32
32
  fetch_schema_from_transport=fetch_schema_from_transport,
33
+ execute_timeout=None, # TODO: Change this after debugging?
33
34
  )
34
35
  return session
35
36
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: primitive
3
- Version: 0.2.4
3
+ Version: 0.2.6
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,12 +1,12 @@
1
- primitive/__about__.py,sha256=HLGxeolXf3nrn1VSeZ6pPXWXzGZDo1pcN7BQwazigE8,129
1
+ primitive/__about__.py,sha256=9_Rz3HWVUTMDWJTUekYW2vaMojK4HXChbHksApwl1K8,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=20ZaX7SuTYeqLCz59IUsIG4kqQu4jDf_iFOp2z-rcyA,12332
9
- primitive/agent/uploader.py,sha256=OkgwXhWKoECOJnW_ZmpzmUS_cpb-orC_uebNcmf5byw,2948
8
+ primitive/agent/runner.py,sha256=y-MWrsDwuF01Ch4MEMvJMC84EUY13SsUYnFWE4RjP3c,12554
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
12
12
  primitive/auth/commands.py,sha256=2z5u5xX64n0yILucx9emtWh3uQXLvs2QQQQIldZGr94,2341
@@ -35,7 +35,7 @@ primitive/git/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
35
35
  primitive/git/graphql/queries.py,sha256=I1HGlqBb1lHIAWVSsC8tVY9JdsQ8DJVqs4nqSTcL30M,98
36
36
  primitive/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  primitive/graphql/relay.py,sha256=bmij2AjdpURQ6GGVCxwWhauF-r_SxuAU2oJ4sDbLxpI,726
38
- primitive/graphql/sdk.py,sha256=DBFH8vw8FAGvRy8_FZc9WcjnwaQDlXmI8fiYmhCg-b0,1458
38
+ primitive/graphql/sdk.py,sha256=XYp-7fAQMSuw8pVv8ZbYric1600bNgSqkTxHLL_ehw4,1526
39
39
  primitive/graphql/utility_fragments.py,sha256=uIjwILC4QtWNyO5vu77VjQf_p0jvP3A9q_6zRq91zqs,303
40
40
  primitive/hardware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  primitive/hardware/actions.py,sha256=4AKXGXraGwNzIzSRT5PpStLz3elc-Og2k4lKnR1NR6w,26092
@@ -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.4.dist-info/METADATA,sha256=4UmGnjVB4WYBQYp5taXS1fY6nTcAKT7If2XltbDFjyc,3669
92
- primitive-0.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- primitive-0.2.4.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
94
- primitive-0.2.4.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
95
- primitive-0.2.4.dist-info/RECORD,,
91
+ primitive-0.2.6.dist-info/METADATA,sha256=bQkcOldWoSH8Nq0yWjsGF1A_F2HCvcbq5CNk20GY-MU,3669
92
+ primitive-0.2.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ primitive-0.2.6.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
94
+ primitive-0.2.6.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
95
+ primitive-0.2.6.dist-info/RECORD,,