primitive 0.2.50__py3-none-any.whl → 0.2.52__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: 2025-present Dylan Stein <dylan@primitive.tech>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.2.50"
4
+ __version__ = "0.2.52"
@@ -89,35 +89,49 @@ class Agent(BaseAction):
89
89
  logger.debug(f"Job Run ID: {job_run_data.get('id')}")
90
90
  logger.debug(f"Job Name: {job_run_data.get('job').get('name')}")
91
91
 
92
- logger.info(
93
- f"Setting JobRun {job_run_data.get('job').get('name')} to request_in_progress"
94
- )
92
+ job_run_status = job_run_data.get("status", None)
95
93
 
96
- job_run_status = job_run_data.get("jobRun", {}).get("status", None)
97
-
98
- while job_run_status != "in_progress":
99
- if job_run_status == "request_completed":
100
- logger.error(
101
- f"JobRun {job_run_data.get('name')} is already completed. Exiting."
102
- )
103
- if RUNNING_IN_CONTAINER:
104
- logger.info("Running in container, exiting after job run")
105
- return
106
- elif job_run_status == "pending":
94
+ while True:
95
+ if job_run_status == "pending":
107
96
  # we are setting to request_in_progress here which puts a started_at time on the JobRun in the API's database
108
97
  # any time spent pulling Git repositories, setting up, etc, counts as compute time
109
- self.primitive.jobs.job_run_update(
98
+ logger.info(
99
+ f"Setting JobRun {job_run_data.get('id')} to request_in_progress."
100
+ )
101
+ # get the status back from the job run update, this should be 'in progress'
102
+ job_run_update_result = self.primitive.jobs.job_run_update(
110
103
  id=job_run_id, status="request_in_progress"
111
104
  )
105
+ job_run_update_data = job_run_update_result.data
106
+ if job_run_update_data is not None:
107
+ # if the job_run_status is not in "in_progress", short circuit
108
+ job_run_status = job_run_update_data.get(
109
+ "jobRunUpdate", {}
110
+ ).get("status", None)
111
+ if job_run_status == "in_progress":
112
+ logger.info(f"JobRun {job_run_data.get('id')} in progress.")
113
+ break
114
+ if (
115
+ job_run_status == "request_completed"
116
+ or job_run_status == "completed"
117
+ ):
118
+ logger.error(
119
+ f"JobRun {job_run_data.get('name')} is already completed with conclusion {job_run_data.get('jobRun', {}).get('conclusion', 'unknown')}. Exiting."
120
+ )
121
+ if RUNNING_IN_CONTAINER:
122
+ logger.info("Running in container, exiting after job run")
123
+ break
124
+
112
125
  logger.info(
113
- f"Waiting for JobRun {job_run_data.get('name')} to be in_progress. Current status: {job_run_status}"
126
+ f"Waiting for JobRun {job_run_data.get('id')} to be in_progress. Current status: {job_run_status}"
114
127
  )
115
- sleep(1)
116
128
  job_run_result = self.primitive.jobs.get_job_run(id=job_run_id)
117
129
  if job_run_result.data is not None:
118
130
  job_run_data = job_run_result.data.get("jobRun", {})
119
131
  job_run_status = job_run_data.get("status", None)
120
132
 
133
+ sleep(1)
134
+
121
135
  try:
122
136
  runner = Runner(
123
137
  primitive=self.primitive,
@@ -67,6 +67,7 @@ class Monitor(BaseAction):
67
67
  # handles cleanup of old reservations
68
68
  # obtains an active JobRun's ID
69
69
  if not RUNNING_IN_CONTAINER:
70
+ self.primitive.hardware.check_in_http(is_online=True)
70
71
  hardware = self.primitive.hardware.get_own_hardware_details()
71
72
  # fetch the latest hardware and activeReservation details
72
73
  if active_reservation_data := hardware["activeReservation"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: primitive
3
- Version: 0.2.50
3
+ Version: 0.2.52
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,9 +1,9 @@
1
- primitive/__about__.py,sha256=pVgRtP9euIj2aqbCG6NFCty_F3aeISv6t3lLrnVIYEo,130
1
+ primitive/__about__.py,sha256=UtAiRLmZsc3f1bwn5K2VjhCbBzl-o3wVd6tEGPtrw_M,130
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=g7EtHI9MATAB0qQu5w-WzbXtxz_8zu8z5E7sETmMkKU,2509
4
4
  primitive/client.py,sha256=RMF46F89oK82gfZH6Bf0WZrhXPUu01pbieSO_Vcuoc4,3624
5
5
  primitive/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- primitive/agent/actions.py,sha256=Ald56Lq8KOtQ0_eFm2TseKkEIa8RP3IClLNVyv9IL4E,7035
6
+ primitive/agent/actions.py,sha256=5lWnhLX8pH972u9WBbgmx3zIUrHhB5KXON4ofPvh84Q,7871
7
7
  primitive/agent/commands.py,sha256=o847pK7v7EWQGG67tky6a33qtwoutX6LZrP2FIS_NOk,388
8
8
  primitive/agent/runner.py,sha256=deMLa4l758k-BeK7Up4LVeD9hXfmAf6o3jJh8OmURys,11315
9
9
  primitive/agent/uploader.py,sha256=ZzrzsajNBogwEC7mT6Ejy0h2Jd9axMYGzt9pbCvVMlk,3171
@@ -54,7 +54,7 @@ primitive/jobs/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
54
54
  primitive/jobs/graphql/fragments.py,sha256=Ldhsc-NFHZGY8_1FjO2uZIdOL5UUGZjsldHea_GLJ_g,667
55
55
  primitive/jobs/graphql/mutations.py,sha256=8ASvCmwQh7cMeeiykOdYaYVryG8FRIuVF6v_J8JJZuw,219
56
56
  primitive/jobs/graphql/queries.py,sha256=ZxNmm-WovytbggNuKRnwa0kc26T34_0yhqkoqx-2uj0,1736
57
- primitive/monitor/actions.py,sha256=nXa8UZT0dXVZma39KDnIpxHt3147xWpnflLIHGOQHpg,9558
57
+ primitive/monitor/actions.py,sha256=vXj6JQC17qNjoVUkOhnvOWMjVIuNUH2jKys3k599Bj8,9632
58
58
  primitive/monitor/commands.py,sha256=VDlEL_Qpm_ysHxug7VpI0cVAZ0ny6AS91Y58D7F1zkU,409
59
59
  primitive/organizations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  primitive/organizations/actions.py,sha256=kVHOhG1oS2sI5p8uldSo5L-RUZsnG36eaulVuKLyZ-M,1863
@@ -95,8 +95,8 @@ primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,37
95
95
  primitive/utils/psutil.py,sha256=xa7ef435UL37jyjmUPbEqCO2ayQMpCs0HCrxVEvLcuM,763
96
96
  primitive/utils/shell.py,sha256=Z4zxmOaSyGCrS0D6I436iQci-ewHLt4UxVg1CD9Serc,2171
97
97
  primitive/utils/text.py,sha256=XiESMnlhjQ534xE2hMNf08WehE1SKaYFRNih0MmnK0k,829
98
- primitive-0.2.50.dist-info/METADATA,sha256=KcFa1iuH5VN3jpBUJD6-85Cnyka0p-cb8wLWmEr_JnQ,3513
99
- primitive-0.2.50.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
100
- primitive-0.2.50.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
101
- primitive-0.2.50.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
102
- primitive-0.2.50.dist-info/RECORD,,
98
+ primitive-0.2.52.dist-info/METADATA,sha256=mDQ41sAqkHcxC1iAP4_9lXskUln2QrHVZllTW1HXoII,3513
99
+ primitive-0.2.52.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
100
+ primitive-0.2.52.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
101
+ primitive-0.2.52.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
102
+ primitive-0.2.52.dist-info/RECORD,,