primitive 0.1.19__py3-none-any.whl → 0.1.21__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 +13 -7
- primitive/jobs/actions.py +8 -2
- primitive/sim/actions.py +22 -12
- {primitive-0.1.19.dist-info → primitive-0.1.21.dist-info}/METADATA +1 -1
- {primitive-0.1.19.dist-info → primitive-0.1.21.dist-info}/RECORD +9 -9
- {primitive-0.1.19.dist-info → primitive-0.1.21.dist-info}/WHEEL +0 -0
- {primitive-0.1.19.dist-info → primitive-0.1.21.dist-info}/entry_points.txt +0 -0
- {primitive-0.1.19.dist-info → primitive-0.1.21.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/agent/actions.py
CHANGED
@@ -65,6 +65,14 @@ class Agent(BaseAction):
|
|
65
65
|
)
|
66
66
|
)
|
67
67
|
|
68
|
+
source_dir = downloaded_git_repository_dir.joinpath(
|
69
|
+
job_run["jobSettings"]["rootDirectory"]
|
70
|
+
)
|
71
|
+
|
72
|
+
cmd = ("make",)
|
73
|
+
if containerArgs := job_run["jobSettings"]["containerArgs"]:
|
74
|
+
cmd = tuple(containerArgs.split(" "))
|
75
|
+
|
68
76
|
match job_run["job"]["slug"]:
|
69
77
|
case "lint":
|
70
78
|
logger.debug("Executing Lint Job")
|
@@ -74,7 +82,7 @@ class Agent(BaseAction):
|
|
74
82
|
)
|
75
83
|
|
76
84
|
result, message = self.primitive.lint.execute(
|
77
|
-
source=
|
85
|
+
source=source_dir
|
78
86
|
)
|
79
87
|
if result:
|
80
88
|
conclusion = "success"
|
@@ -96,16 +104,14 @@ class Agent(BaseAction):
|
|
96
104
|
)
|
97
105
|
|
98
106
|
result, message = self.primitive.sim.execute(
|
99
|
-
source=
|
100
|
-
cmd=(
|
101
|
-
"make",
|
102
|
-
"all",
|
103
|
-
), # TODO: Change this to use container args container cmd
|
107
|
+
source=source_dir, cmd=cmd
|
104
108
|
)
|
105
109
|
|
106
110
|
# Attempt artifact collection
|
107
111
|
self.primitive.sim.collect_artifacts(
|
108
|
-
source=
|
112
|
+
source=source_dir,
|
113
|
+
job_run_id=job_run["id"],
|
114
|
+
organization_id=job_run["organization"]["id"],
|
109
115
|
)
|
110
116
|
|
111
117
|
if result:
|
primitive/jobs/actions.py
CHANGED
@@ -125,10 +125,13 @@ fragment JobRunFragment on JobRun {
|
|
125
125
|
name
|
126
126
|
createdAt
|
127
127
|
updatedAt
|
128
|
-
}
|
128
|
+
}
|
129
|
+
organization {
|
130
|
+
id
|
131
|
+
}
|
129
132
|
jobSettings {
|
130
133
|
containerArgs
|
131
|
-
|
134
|
+
rootDirectory
|
132
135
|
}
|
133
136
|
gitCommit {
|
134
137
|
sha
|
@@ -222,6 +225,9 @@ query jobRuns(
|
|
222
225
|
branch
|
223
226
|
repoFullName
|
224
227
|
}
|
228
|
+
organization {
|
229
|
+
id
|
230
|
+
}
|
225
231
|
}
|
226
232
|
|
227
233
|
query jobRun($id: GlobalID!) {
|
primitive/sim/actions.py
CHANGED
@@ -46,37 +46,45 @@ class Sim(BaseAction):
|
|
46
46
|
|
47
47
|
return True, message
|
48
48
|
|
49
|
-
def upload_file(self, path: Path) -> str:
|
50
|
-
file_upload_response = self.primitive.files.file_upload(
|
51
|
-
path, key_prefix=f"{self.job_run_id}/{str(path.parent)}"
|
52
|
-
)
|
49
|
+
def upload_file(self, path: Path, prefix: str) -> str:
|
50
|
+
file_upload_response = self.primitive.files.file_upload(path, key_prefix=prefix)
|
53
51
|
return file_upload_response.json()["data"]["fileUpload"]["id"]
|
54
52
|
|
55
|
-
def collect_artifacts(
|
53
|
+
def collect_artifacts(
|
54
|
+
self, source: Path, job_run_id: str, organization_id: str
|
55
|
+
) -> None:
|
56
56
|
file_ids = []
|
57
57
|
|
58
58
|
# Look for VCD artifacts
|
59
59
|
files = find_files_for_extension(source, ".vcd")
|
60
60
|
for file in files:
|
61
|
-
trace_file_ids = self.generate_timeseries(
|
61
|
+
trace_file_ids = self.generate_timeseries(
|
62
|
+
path=file, job_run_id=job_run_id, organization_id=organization_id
|
63
|
+
)
|
62
64
|
file_ids.extend(trace_file_ids)
|
63
65
|
|
64
66
|
logger.debug("Uploading additional artifacts...")
|
65
67
|
files = find_files_for_extension(source, (".xml", ".vcd", ".log", ".history"))
|
66
68
|
for file_path in files:
|
67
69
|
try:
|
68
|
-
file_ids.append(
|
70
|
+
file_ids.append(
|
71
|
+
self.upload_file(
|
72
|
+
file_path, prefix=f"{job_run_id}/{str(file_path.parent)}"
|
73
|
+
)
|
74
|
+
)
|
69
75
|
except FileNotFoundError:
|
70
76
|
logger.warning(f"{file_path} not found...")
|
71
77
|
|
72
78
|
logger.debug("Updating job run...")
|
73
79
|
if len(file_ids) > 0:
|
74
80
|
job_run_update_response = self.primitive.jobs.job_run_update(
|
75
|
-
id=
|
81
|
+
id=job_run_id, file_ids=file_ids
|
76
82
|
)
|
77
83
|
logger.success(job_run_update_response)
|
78
84
|
|
79
|
-
def generate_timeseries(
|
85
|
+
def generate_timeseries(
|
86
|
+
self, path: Path, job_run_id: str, organization_id: str
|
87
|
+
) -> List[str]:
|
80
88
|
logger.debug("Parsing VCD file...")
|
81
89
|
with open(path, "rb") as f:
|
82
90
|
tokens = tokenize(io.BytesIO(f.read()))
|
@@ -128,7 +136,9 @@ class Sim(BaseAction):
|
|
128
136
|
with open(file_path, "w") as f:
|
129
137
|
f.write(json.dumps(timeseries))
|
130
138
|
|
131
|
-
trace_file_id = self.upload_file(
|
139
|
+
trace_file_id = self.upload_file(
|
140
|
+
file_path, prefix=f"{job_run_id}/{str(file_path.parent)}"
|
141
|
+
)
|
132
142
|
trace_file_ids.append(trace_file_id)
|
133
143
|
|
134
144
|
self.trace_create(
|
@@ -140,9 +150,9 @@ class Sim(BaseAction):
|
|
140
150
|
bit_index=metadata[id_code]["bit_index"],
|
141
151
|
timescale_unit=timescale_unit,
|
142
152
|
timescale_magnitude=timescale_magnitude,
|
143
|
-
organization=
|
153
|
+
organization=organization_id,
|
144
154
|
file=trace_file_id,
|
145
|
-
job_run=
|
155
|
+
job_run=job_run_id,
|
146
156
|
)
|
147
157
|
|
148
158
|
return trace_file_ids
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.21
|
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=
|
1
|
+
primitive/__about__.py,sha256=JiIZ_OJnMBk7JQxWOZ-Ln2mvyV5v9BfpDzkeFWd4wQ0,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=
|
5
|
+
primitive/agent/actions.py,sha256=CFb44aKPG2IF4c2Jqb0sBj4iA7VCtojcaGHgWdrtLYE,5407
|
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
|
@@ -20,7 +20,7 @@ primitive/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
20
20
|
primitive/graphql/sdk.py,sha256=BhCGmDtc4sNnH8CxbQSJyFwOZ-ZSqMtjsxMB3JRBhPw,1456
|
21
21
|
primitive/hardware/actions.py,sha256=Ea3_2E3F_3WapV60g_mOIcpXhadoknwihR7slXyUWtk,18840
|
22
22
|
primitive/hardware/commands.py,sha256=QE7LLeFdfOqlvz3JwdwJJRZAY3fHI1zB9kYmmDajpq0,1477
|
23
|
-
primitive/jobs/actions.py,sha256=
|
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
|
@@ -30,7 +30,7 @@ primitive/projects/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
30
30
|
primitive/projects/actions.py,sha256=xhebDUMN9DXWvngWJyJkiijghbZwffy-JIPSsOg8agE,2061
|
31
31
|
primitive/projects/commands.py,sha256=Fqqgpi4cm6zOgkHK--0F0hiiIj32BmgZ-h1MydmWwdE,464
|
32
32
|
primitive/sim/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
primitive/sim/actions.py,sha256=
|
33
|
+
primitive/sim/actions.py,sha256=vmhiFH8WhQgVEeIHG9r2Gxb5ZZMdk19JYiz5r2F21cg,6864
|
34
34
|
primitive/sim/commands.py,sha256=8PaOfL1MO6qxTn7mNVRnBU1X2wa3gk_mlbAhBW6MnI0,591
|
35
35
|
primitive/sim/vcd.py,sha256=mAbGnKWM0qzIUMkuSmO0p3sU25kOqbl31mvCsDSrXeM,22221
|
36
36
|
primitive/utils/actions.py,sha256=HOFrmM3-0A_A3NS84MqrZ6JmQEiiPSoDqEeuu6b_qfQ,196
|
@@ -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.
|
45
|
-
primitive-0.1.
|
46
|
-
primitive-0.1.
|
47
|
-
primitive-0.1.
|
48
|
-
primitive-0.1.
|
44
|
+
primitive-0.1.21.dist-info/METADATA,sha256=MherRu1tZf7ePM5Inx7ebfvihZOrYKJlxMgSYQrTt80,1818
|
45
|
+
primitive-0.1.21.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
46
|
+
primitive-0.1.21.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
47
|
+
primitive-0.1.21.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
48
|
+
primitive-0.1.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|