primitive 0.1.19__tar.gz → 0.1.21__tar.gz

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.
Files changed (57) hide show
  1. {primitive-0.1.19 → primitive-0.1.21}/PKG-INFO +1 -1
  2. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/__about__.py +1 -1
  3. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/agent/actions.py +13 -7
  4. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/jobs/actions.py +8 -2
  5. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/sim/actions.py +22 -12
  6. {primitive-0.1.19 → primitive-0.1.21}/.git-hooks/pre-commit +0 -0
  7. {primitive-0.1.19 → primitive-0.1.21}/.gitattributes +0 -0
  8. {primitive-0.1.19 → primitive-0.1.21}/.github/workflows/lint.yml +0 -0
  9. {primitive-0.1.19 → primitive-0.1.21}/.github/workflows/publish.yml +0 -0
  10. {primitive-0.1.19 → primitive-0.1.21}/.gitignore +0 -0
  11. {primitive-0.1.19 → primitive-0.1.21}/.vscode/settings.json +0 -0
  12. {primitive-0.1.19 → primitive-0.1.21}/LICENSE.txt +0 -0
  13. {primitive-0.1.19 → primitive-0.1.21}/Makefile +0 -0
  14. {primitive-0.1.19 → primitive-0.1.21}/README.md +0 -0
  15. {primitive-0.1.19 → primitive-0.1.21}/linux setup.md +0 -0
  16. {primitive-0.1.19 → primitive-0.1.21}/pyproject.toml +0 -0
  17. {primitive-0.1.19 → primitive-0.1.21}/requirements.txt +0 -0
  18. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/__init__.py +0 -0
  19. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/agent/commands.py +0 -0
  20. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/auth/__init__.py +0 -0
  21. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/auth/actions.py +0 -0
  22. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/auth/commands.py +0 -0
  23. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/cli.py +0 -0
  24. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/client.py +0 -0
  25. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/daemons/actions.py +0 -0
  26. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/daemons/commands.py +0 -0
  27. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/daemons/launch_agents.py +0 -0
  28. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/daemons/launch_service.py +0 -0
  29. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/files/actions.py +0 -0
  30. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/files/commands.py +0 -0
  31. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/git/__init__.py +0 -0
  32. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/git/actions.py +0 -0
  33. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/git/commands.py +0 -0
  34. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/graphql/__init__.py +0 -0
  35. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/graphql/sdk.py +0 -0
  36. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/hardware/actions.py +0 -0
  37. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/hardware/commands.py +0 -0
  38. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/jobs/commands.py +0 -0
  39. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/lint/actions.py +0 -0
  40. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/lint/commands.py +0 -0
  41. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/organizations/actions.py +0 -0
  42. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/organizations/commands.py +0 -0
  43. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/projects/__init__.py +0 -0
  44. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/projects/actions.py +0 -0
  45. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/projects/commands.py +0 -0
  46. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/sim/__init__.py +0 -0
  47. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/sim/commands.py +0 -0
  48. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/sim/vcd.py +0 -0
  49. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/actions.py +0 -0
  50. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/config.py +0 -0
  51. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/files.py +0 -0
  52. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/git.py +0 -0
  53. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/memory_size.py +0 -0
  54. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/printer.py +0 -0
  55. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/shell.py +0 -0
  56. {primitive-0.1.19 → primitive-0.1.21}/src/primitive/utils/verible.py +0 -0
  57. {primitive-0.1.19 → primitive-0.1.21}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.19
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,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.19"
4
+ __version__ = "0.1.21"
@@ -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=downloaded_git_repository_dir
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=downloaded_git_repository_dir,
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=downloaded_git_repository_dir
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:
@@ -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
- containerCommand
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!) {
@@ -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(self, source) -> None:
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(path=file)
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(self.upload_file(file_path))
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=self.job_run_id, file_ids=file_ids
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(self, path: Path) -> List[str]:
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(file_path)
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=self.organization_id,
153
+ organization=organization_id,
144
154
  file=trace_file_id,
145
- job_run=self.job_run_id,
155
+ job_run=job_run_id,
146
156
  )
147
157
 
148
158
  return trace_file_ids
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes