primitive 0.1.20__py3-none-any.whl → 0.1.22__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@steins.studio>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.1.20"
4
+ __version__ = "0.1.22"
@@ -21,15 +21,40 @@ class Agent(BaseAction):
21
21
  sys.exit(1)
22
22
 
23
23
  try:
24
+ active_reservation_id = None
25
+ active_reservation_pk = None
26
+
24
27
  while True:
25
28
  hardware = self.primitive.hardware.get_own_hardware_details()
29
+ if hardware["activeReservation"]:
30
+ if (
31
+ hardware["activeReservation"]["id"] != active_reservation_id
32
+ or hardware["activeReservation"]["pk"] != active_reservation_pk
33
+ ):
34
+ logger.warning("New reservation for this hardware.")
35
+ active_reservation_id = hardware["activeReservation"]["id"]
36
+ active_reservation_pk = hardware["activeReservation"]["pk"]
37
+ logger.debug("Active Reservation:")
38
+ logger.debug(f"Node ID: {active_reservation_id}")
39
+ logger.debug(f"PK: {active_reservation_pk}")
40
+ else:
41
+ if (
42
+ hardware["activeReservation"] is None
43
+ and active_reservation_id is not None
44
+ and hardware["isAvailable"]
45
+ ):
46
+ logger.debug("Previous Reservation is Complete:")
47
+ logger.debug(f"Node ID: {active_reservation_id}")
48
+ logger.debug(f"PK: {active_reservation_pk}")
49
+ active_reservation_id = None
50
+ active_reservation_pk = None
26
51
 
27
- active_reservation_id = None
28
- if hardware.get("activeReservation"):
29
- active_reservation_id = hardware["activeReservation"]["id"]
30
52
  if not active_reservation_id:
31
- logger.debug("No active reservation found")
32
- sleep(5)
53
+ sleep_amount = 5
54
+ logger.debug(
55
+ f"No active reservation found... [sleeping {sleep_amount} seconds]"
56
+ )
57
+ sleep(sleep_amount)
33
58
  continue
34
59
 
35
60
  job_runs_data = self.primitive.jobs.get_job_runs(
@@ -40,6 +65,14 @@ class Agent(BaseAction):
40
65
  edge["node"] for edge in job_runs_data["jobRuns"]["edges"]
41
66
  ]
42
67
 
68
+ if not pending_job_runs:
69
+ sleep_amount = 5
70
+ logger.debug(
71
+ f"Waiting for Job Runs... [sleeping {sleep_amount} seconds]"
72
+ )
73
+ sleep(sleep_amount)
74
+ continue
75
+
43
76
  for job_run in pending_job_runs:
44
77
  logger.debug("Found pending Job Run")
45
78
  logger.debug(f"Job Run ID: {job_run['id']}")
@@ -65,6 +98,14 @@ class Agent(BaseAction):
65
98
  )
66
99
  )
67
100
 
101
+ source_dir = downloaded_git_repository_dir.joinpath(
102
+ job_run["jobSettings"]["rootDirectory"]
103
+ )
104
+
105
+ cmd = ("make",)
106
+ if containerArgs := job_run["jobSettings"]["containerArgs"]:
107
+ cmd = tuple(containerArgs.split(" "))
108
+
68
109
  match job_run["job"]["slug"]:
69
110
  case "lint":
70
111
  logger.debug("Executing Lint Job")
@@ -74,7 +115,7 @@ class Agent(BaseAction):
74
115
  )
75
116
 
76
117
  result, message = self.primitive.lint.execute(
77
- source=downloaded_git_repository_dir
118
+ source=source_dir
78
119
  )
79
120
  if result:
80
121
  conclusion = "success"
@@ -95,17 +136,13 @@ class Agent(BaseAction):
95
136
  job_run["id"], status="request_in_progress"
96
137
  )
97
138
 
98
- cmd = ("make",)
99
- if containerArgs := job_run["jobSettings"]["containerArgs"]:
100
- cmd = tuple(containerArgs.split(" "))
101
-
102
139
  result, message = self.primitive.sim.execute(
103
- source=downloaded_git_repository_dir, cmd=cmd
140
+ source=source_dir, cmd=cmd
104
141
  )
105
142
 
106
143
  # Attempt artifact collection
107
144
  self.primitive.sim.collect_artifacts(
108
- source=downloaded_git_repository_dir,
145
+ source=source_dir,
109
146
  job_run_id=job_run["id"],
110
147
  organization_id=job_run["organization"]["id"],
111
148
  )
@@ -464,6 +464,10 @@ fragment HardwareFragment on Hardware {
464
464
  slug
465
465
  createdAt
466
466
  updatedAt
467
+ isAvailable
468
+ isOnline
469
+ isQuarantined
470
+ isHealthy
467
471
  capabilities {
468
472
  id
469
473
  pk
primitive/jobs/actions.py CHANGED
@@ -131,6 +131,7 @@ fragment JobRunFragment on JobRun {
131
131
  }
132
132
  jobSettings {
133
133
  containerArgs
134
+ rootDirectory
134
135
  }
135
136
  gitCommit {
136
137
  sha
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.20
3
+ Version: 0.1.22
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,8 +1,8 @@
1
- primitive/__about__.py,sha256=7eoCOvzu9H0d1p_Cn8tHVxRG_98gwgBZVH4ubq5VuRo,129
1
+ primitive/__about__.py,sha256=GLbyQLa84sxg9eRnmnWkVVauDFJZS0FGa5ocDebd_3g,129
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=VQPSewC6ouGdEG9W1gllawGJTydpOY0Lzg7LURXcqQg,2374
4
4
  primitive/client.py,sha256=SFPG4H2wJao8euGdnYp-l7dk_fDpWeVn2aT2WNJUAqo,2370
5
- primitive/agent/actions.py,sha256=nFBF4BtuX41B-W4aRfsZ8IjZpLJm3PkHW17oK81_wXM,5328
5
+ primitive/agent/actions.py,sha256=uTT3Ke95BTL9haAHFhPJPasZEDlqDuC2uEF03Omap7E,7020
6
6
  primitive/agent/commands.py,sha256=-dVDilELfkGfbZB7qfEPs77Dm1oT62qJj4tsIk4KoxI,254
7
7
  primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  primitive/auth/actions.py,sha256=N2bGcwXNsB89pzs66gF9A5_WzUScY5fhfOyWixqo2y8,1054
@@ -18,9 +18,9 @@ primitive/git/actions.py,sha256=fepcl5529w_hsaC6fBw9f-QHeyqNjGXz8HI5ebzbZMs,1386
18
18
  primitive/git/commands.py,sha256=64B2STTOn0dwVDmJHqEwekmIqKMfSyBBFwKg29Wt8Aw,1230
19
19
  primitive/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  primitive/graphql/sdk.py,sha256=BhCGmDtc4sNnH8CxbQSJyFwOZ-ZSqMtjsxMB3JRBhPw,1456
21
- primitive/hardware/actions.py,sha256=Ea3_2E3F_3WapV60g_mOIcpXhadoknwihR7slXyUWtk,18840
21
+ primitive/hardware/actions.py,sha256=JJXEeW35QzVGcLN4ym5gYZwY71hxLzM1GYPXWaObEts,18893
22
22
  primitive/hardware/commands.py,sha256=QE7LLeFdfOqlvz3JwdwJJRZAY3fHI1zB9kYmmDajpq0,1477
23
- primitive/jobs/actions.py,sha256=Bs7bpS6J-RItjuZtk6m89Lbb-MFzBotrzli657J4m-A,7700
23
+ primitive/jobs/actions.py,sha256=1Mc-bg4nCd5qiKC-hPODveTPZwwo0Kztl5BuidLr-Sc,7718
24
24
  primitive/jobs/commands.py,sha256=MxPCkBEYW_eLNqgCRYeyj7ZcLOFAWfpVZlqDR2Y_S0o,830
25
25
  primitive/lint/actions.py,sha256=fGnNlcD_B-E0SvRUTvTdSlTm2kCQUTrlBLB0mt1sXKM,2268
26
26
  primitive/lint/commands.py,sha256=3CZvkOEMpJspJWmaQzA5bpPKx0_VCijQIXA9l-eTnZE,487
@@ -41,8 +41,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
41
41
  primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
42
42
  primitive/utils/shell.py,sha256=-7UjQaBqSGHzEEyX8pNjeYFFP0P3lVnDV0OkgPz1qHU,1050
43
43
  primitive/utils/verible.py,sha256=QYczN1IvxODfj4jeq0nqjFuF0Oi0Zdx-Q32ySOJgcw8,2205
44
- primitive-0.1.20.dist-info/METADATA,sha256=uWAq11mVwGfTB8nCQAzyM0AHnhdwdfE1_kny1KxJ-nw,1818
45
- primitive-0.1.20.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
46
- primitive-0.1.20.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
47
- primitive-0.1.20.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
48
- primitive-0.1.20.dist-info/RECORD,,
44
+ primitive-0.1.22.dist-info/METADATA,sha256=O1FnkxZf7VZ8cu575Na1xlA2-6z6esA-sqgWp-0sWtc,1818
45
+ primitive-0.1.22.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
46
+ primitive-0.1.22.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
47
+ primitive-0.1.22.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
48
+ primitive-0.1.22.dist-info/RECORD,,