primitive 0.2.52__py3-none-any.whl → 0.2.53__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/actions.py +40 -41
- primitive/agent/uploader.py +12 -10
- {primitive-0.2.52.dist-info → primitive-0.2.53.dist-info}/METADATA +1 -1
- {primitive-0.2.52.dist-info → primitive-0.2.53.dist-info}/RECORD +8 -8
- {primitive-0.2.52.dist-info → primitive-0.2.53.dist-info}/WHEEL +0 -0
- {primitive-0.2.52.dist-info → primitive-0.2.53.dist-info}/entry_points.txt +0 -0
- {primitive-0.2.52.dist-info → primitive-0.2.53.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/agent/actions.py
CHANGED
@@ -118,56 +118,55 @@ class Agent(BaseAction):
|
|
118
118
|
logger.error(
|
119
119
|
f"JobRun {job_run_data.get('name')} is already completed with conclusion {job_run_data.get('jobRun', {}).get('conclusion', 'unknown')}. Exiting."
|
120
120
|
)
|
121
|
-
|
122
|
-
logger.info("Running in container, exiting after job run")
|
123
|
-
break
|
121
|
+
break
|
124
122
|
|
125
|
-
logger.info(
|
126
|
-
f"Waiting for JobRun {job_run_data.get('id')} to be in_progress. Current status: {job_run_status}"
|
127
|
-
)
|
128
123
|
job_run_result = self.primitive.jobs.get_job_run(id=job_run_id)
|
129
124
|
if job_run_result.data is not None:
|
130
125
|
job_run_data = job_run_result.data.get("jobRun", {})
|
131
126
|
job_run_status = job_run_data.get("status", None)
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
try:
|
136
|
-
runner = Runner(
|
137
|
-
primitive=self.primitive,
|
138
|
-
job_run=job_run_data,
|
139
|
-
)
|
140
|
-
runner.setup()
|
141
|
-
except Exception as exception:
|
142
|
-
logger.exception(
|
143
|
-
f"Exception while initializing runner: {exception}"
|
144
|
-
)
|
145
|
-
self.primitive.jobs.job_run_update(
|
146
|
-
id=job_run_id,
|
147
|
-
status="request_completed",
|
148
|
-
conclusion="failure",
|
127
|
+
logger.info(
|
128
|
+
f"Waiting for JobRun {job_run_data.get('id')} to be in_progress. Current status: {job_run_status}"
|
149
129
|
)
|
150
|
-
|
130
|
+
sleep(1)
|
151
131
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
132
|
+
# the backend has said it's okay for the agent to run this job
|
133
|
+
if job_run_status == "in_progress":
|
134
|
+
try:
|
135
|
+
runner = Runner(
|
136
|
+
primitive=self.primitive,
|
137
|
+
job_run=job_run_data,
|
138
|
+
)
|
139
|
+
runner.setup()
|
140
|
+
except Exception as exception:
|
141
|
+
logger.exception(
|
142
|
+
f"Exception while initializing runner: {exception}"
|
143
|
+
)
|
144
|
+
self.primitive.jobs.job_run_update(
|
145
|
+
id=job_run_id,
|
146
|
+
status="request_completed",
|
147
|
+
conclusion="failure",
|
148
|
+
)
|
149
|
+
continue
|
150
|
+
|
151
|
+
try:
|
152
|
+
runner.execute_job_run()
|
153
|
+
except Exception as exception:
|
154
|
+
logger.exception(f"Exception while executing job: {exception}")
|
155
|
+
self.primitive.jobs.job_run_update(
|
156
|
+
id=job_run_id,
|
157
|
+
status="request_completed",
|
158
|
+
conclusion="failure",
|
159
|
+
)
|
160
|
+
finally:
|
161
|
+
runner.cleanup()
|
163
162
|
|
164
|
-
|
165
|
-
|
166
|
-
|
163
|
+
# NOTE: also run scan here to force upload of artifacts
|
164
|
+
# This should probably eventually be another daemon?
|
165
|
+
uploader.scan()
|
167
166
|
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
if RUNNING_IN_CONTAINER:
|
168
|
+
logger.info("Running in container, exiting after job run")
|
169
|
+
break
|
171
170
|
|
172
171
|
sleep(5)
|
173
172
|
except KeyboardInterrupt:
|
primitive/agent/uploader.py
CHANGED
@@ -46,22 +46,24 @@ class Uploader:
|
|
46
46
|
|
47
47
|
for file in files:
|
48
48
|
try:
|
49
|
-
|
49
|
+
upload_file_result = self.primitive.files.upload_file_direct(
|
50
50
|
path=file,
|
51
51
|
key_prefix=str(PurePath(file).relative_to(cache.parent).parent),
|
52
52
|
)
|
53
|
-
except Exception as exception:
|
54
|
-
if "is empty" in str(exception):
|
55
|
-
logger.warning(f"{file} is empty, skipping upload")
|
56
|
-
continue
|
57
53
|
|
58
|
-
|
54
|
+
if upload_file_result and upload_file_result.data is not None:
|
55
|
+
upload_file_data = upload_file_result.data
|
56
|
+
upload_id = upload_file_data.get("fileUpdate", {}).get("id")
|
59
57
|
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
if upload_id:
|
59
|
+
file_ids.append(upload_id)
|
60
|
+
continue
|
63
61
|
|
64
|
-
|
62
|
+
logger.error(f"Unable to upload file {file}")
|
63
|
+
except Exception as exception:
|
64
|
+
if "is empty" in str(exception):
|
65
|
+
logger.warning(f"{file} is empty, skipping upload")
|
66
|
+
continue
|
65
67
|
|
66
68
|
# Clean up job cache
|
67
69
|
shutil.rmtree(path=cache)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.53
|
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=
|
1
|
+
primitive/__about__.py,sha256=lSz0mtiMJzyxukJ01ol9sDoiQlVzFFSwYibTsET0ZRo,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
|
6
|
+
primitive/agent/actions.py,sha256=-vHuwZZv8tWfq5SSljr18tUJz3BbyodrfdXKZvvrWEM,7993
|
7
7
|
primitive/agent/commands.py,sha256=o847pK7v7EWQGG67tky6a33qtwoutX6LZrP2FIS_NOk,388
|
8
8
|
primitive/agent/runner.py,sha256=deMLa4l758k-BeK7Up4LVeD9hXfmAf6o3jJh8OmURys,11315
|
9
|
-
primitive/agent/uploader.py,sha256=
|
9
|
+
primitive/agent/uploader.py,sha256=DT_Nzt5eOTm_uRcYKm1sjBBaQZzp5iNZ_uN5XktfQ30,3382
|
10
10
|
primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
primitive/auth/actions.py,sha256=9NIEXJ1BNJutJs6AMMSjMN_ziONUAUhY_xHwojYJCLA,942
|
12
12
|
primitive/auth/commands.py,sha256=Krm38ioduDJZw0OIrIcb6eR2X6iECiWX0JPAI-2HNxY,2352
|
@@ -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.
|
99
|
-
primitive-0.2.
|
100
|
-
primitive-0.2.
|
101
|
-
primitive-0.2.
|
102
|
-
primitive-0.2.
|
98
|
+
primitive-0.2.53.dist-info/METADATA,sha256=hflPnuPJOARIUnf8e9toXIKDpGzCpwNqbFPt-J7BAAw,3513
|
99
|
+
primitive-0.2.53.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
100
|
+
primitive-0.2.53.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
101
|
+
primitive-0.2.53.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
102
|
+
primitive-0.2.53.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|