primitive 0.1.9__tar.gz → 0.1.11__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 (43) hide show
  1. {primitive-0.1.9 → primitive-0.1.11}/PKG-INFO +1 -1
  2. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/__about__.py +1 -1
  3. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/agent/actions.py +5 -1
  4. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/hardware/actions.py +36 -28
  5. {primitive-0.1.9 → primitive-0.1.11}/.git-hooks/pre-commit +0 -0
  6. {primitive-0.1.9 → primitive-0.1.11}/.gitattributes +0 -0
  7. {primitive-0.1.9 → primitive-0.1.11}/.github/workflows/lint.yml +0 -0
  8. {primitive-0.1.9 → primitive-0.1.11}/.github/workflows/publish.yml +0 -0
  9. {primitive-0.1.9 → primitive-0.1.11}/.gitignore +0 -0
  10. {primitive-0.1.9 → primitive-0.1.11}/.vscode/settings.json +0 -0
  11. {primitive-0.1.9 → primitive-0.1.11}/LICENSE.txt +0 -0
  12. {primitive-0.1.9 → primitive-0.1.11}/Makefile +0 -0
  13. {primitive-0.1.9 → primitive-0.1.11}/README.md +0 -0
  14. {primitive-0.1.9 → primitive-0.1.11}/linux setup.md +0 -0
  15. {primitive-0.1.9 → primitive-0.1.11}/pyproject.toml +0 -0
  16. {primitive-0.1.9 → primitive-0.1.11}/requirements.txt +0 -0
  17. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/__init__.py +0 -0
  18. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/agent/commands.py +0 -0
  19. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/auth/__init__.py +0 -0
  20. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/auth/actions.py +0 -0
  21. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/auth/commands.py +0 -0
  22. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/cli.py +0 -0
  23. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/client.py +0 -0
  24. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/files/actions.py +0 -0
  25. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/files/commands.py +0 -0
  26. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/graphql/__init__.py +0 -0
  27. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/graphql/sdk.py +0 -0
  28. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/hardware/commands.py +0 -0
  29. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/lint/actions.py +0 -0
  30. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/lint/commands.py +0 -0
  31. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/projects/__init__.py +0 -0
  32. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/projects/actions.py +0 -0
  33. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/simulations/__init__.py +0 -0
  34. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/simulations/actions.py +0 -0
  35. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/actions.py +0 -0
  36. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/config.py +0 -0
  37. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/files.py +0 -0
  38. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/git.py +0 -0
  39. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/memory_size.py +0 -0
  40. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/printer.py +0 -0
  41. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/shell.py +0 -0
  42. {primitive-0.1.9 → primitive-0.1.11}/src/primitive/utils/verible.py +0 -0
  43. {primitive-0.1.9 → primitive-0.1.11}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.9
3
+ Version: 0.1.11
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.9"
4
+ __version__ = "0.1.11"
@@ -14,7 +14,11 @@ class Agent(BaseAction):
14
14
  logger.info(f" [*] Version: {__version__}")
15
15
 
16
16
  # self.primitive.hardware.update_hardware_system_info()
17
- self.primitive.hardware.check_in_http(is_available=True, is_online=True)
17
+ try:
18
+ self.primitive.hardware.check_in_http(is_available=True, is_online=True)
19
+ except Exception as ex:
20
+ logger.error(f"Error checking in hardware: {ex}")
21
+ sys.exit(1)
18
22
 
19
23
  try:
20
24
  while True:
@@ -171,12 +171,6 @@ class Hardware(BaseAction):
171
171
 
172
172
  gpu_config.append(gpu_info)
173
173
 
174
- # Raise an error if there is no valid gpu config
175
- if not gpu_config:
176
- message = "No valid gpu configuration"
177
- logger.error(message)
178
- raise NotImplementedError(message)
179
-
180
174
  return gpu_config
181
175
 
182
176
  def _get_windows_computer_service_product_values(self) -> Dict[str, str]:
@@ -417,29 +411,43 @@ class Hardware(BaseAction):
417
411
  input = new_state
418
412
  variables = {"input": input}
419
413
  try:
420
- result = self.primitive.session.execute(mutation, variable_values=variables)
421
- previous_state = self.previous_state
422
- self.previous_state = new_state.copy()
423
-
424
- message = " [*] Checked in successfully: "
425
- for key, value in new_state.items():
426
- if value != previous_state.get(key, None):
427
- if value is True:
428
- message = (
429
- message
430
- + click.style(f"{key}: ")
431
- + click.style("💤")
432
- + click.style(" ==> ✅ ", fg="green")
433
- )
414
+ result = self.primitive.session.execute(
415
+ mutation, variable_values=variables, get_execution_result=True
416
+ )
417
+ checkin_success = result.data.get("checkIn").get("lastCheckIn")
418
+ if messages := result.data.get("checkIn").get("messages"):
419
+ for message in messages:
420
+ logger.enable("primitive")
421
+ if message.get("kind") == "ERROR":
422
+ logger.error(message.get("message"))
434
423
  else:
435
- message = (
436
- message
437
- + click.style(f"{key}: ")
438
- + click.style("✅")
439
- + click.style(" ==> 💤 ", fg="yellow")
440
- )
441
- logger.info(message)
442
-
424
+ logger.debug(message.get("message"))
425
+
426
+ if checkin_success:
427
+ previous_state = self.previous_state
428
+ self.previous_state = new_state.copy()
429
+
430
+ message = " [*] Checked in successfully: "
431
+ for key, value in new_state.items():
432
+ if value != previous_state.get(key, None):
433
+ if value is True:
434
+ message = (
435
+ message
436
+ + click.style(f"{key}: ")
437
+ + click.style("💤")
438
+ + click.style(" ==> ✅ ", fg="green")
439
+ )
440
+ else:
441
+ message = (
442
+ message
443
+ + click.style(f"{key}: ")
444
+ + click.style("✅")
445
+ + click.style(" ==> 💤 ", fg="yellow")
446
+ )
447
+ logger.info(message)
448
+ else:
449
+ message = "Failed to check in!"
450
+ raise Exception(message)
443
451
  return result
444
452
  except client_exceptions.ClientConnectorError as exception:
445
453
  message = " [*] Failed to check in! "
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