artefacts-cli 0.9.4__py3-none-any.whl → 0.9.5__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.
artefacts/cli/__init__.py CHANGED
@@ -32,7 +32,15 @@ except PackageNotFoundError:
32
32
  __version__ = "0.0.0"
33
33
 
34
34
 
35
- class AuthenticationError(Exception):
35
+ class ArtefactsAPIError(Exception):
36
+ """
37
+ Tentative base error class for Artefacts API interactions
38
+ """
39
+
40
+ pass
41
+
42
+
43
+ class AuthenticationError(ArtefactsAPIError):
36
44
  """Raised when artefacts authentication failed"""
37
45
 
38
46
  pass
@@ -74,6 +82,7 @@ class WarpJob:
74
82
  if self.job_id is None:
75
83
  # Only create a new job if job_id is not specified
76
84
  data = {
85
+ "project_id": self.project_id,
77
86
  "start": round(self.start),
78
87
  "status": "in progress",
79
88
  "params": json.dumps(self.params),
@@ -100,7 +109,7 @@ class WarpJob:
100
109
  )
101
110
  )
102
111
  logger.warning(response.text)
103
- raise AuthenticationError(str(response.status_code))
112
+ raise ArtefactsAPIError(str(response.status_code))
104
113
  self.job_id = response.json()["job_id"]
105
114
  self.output_path = self.params.get("output_path", f"/tmp/{self.job_id}")
106
115
  os.makedirs(self.output_path, exist_ok=True)
@@ -109,20 +118,21 @@ class WarpJob:
109
118
  def log_tests_result(self, success):
110
119
  self.success = success
111
120
 
112
- def update(self, last_run_success: bool):
121
+ def update(self, last_run_success: bool) -> bool:
113
122
  end = datetime.now(timezone.utc).timestamp()
114
123
  if self.dryrun:
115
- return
124
+ return True
116
125
  # Log metadata
117
126
  data = {
127
+ "project_id": self.project_id,
118
128
  "end": round(end),
119
129
  "duration": round(end - self.start),
120
130
  "success": last_run_success,
121
131
  "status": "finished", # need to be determined based on all runs
122
132
  }
123
- self.api_conf.update("job", self.job_id, data)
133
+ response = self.api_conf.update("job", self.job_id, data)
124
134
 
125
- return
135
+ return response.status_code == 200
126
136
 
127
137
  def new_run(self, scenario):
128
138
  run = WarpRun(self, scenario["name"], scenario, self.n_runs)
@@ -173,7 +183,7 @@ class WarpRun:
173
183
  )
174
184
  )
175
185
  self.logger.warning(response.text)
176
- raise AuthenticationError(str(response.status_code))
186
+ raise ArtefactsAPIError(str(response.status_code))
177
187
  return
178
188
 
179
189
  def log_params(self, params):
artefacts/cli/config.py CHANGED
@@ -25,7 +25,11 @@ urllib3logger.setLevel(logging.ERROR)
25
25
 
26
26
  class APIConf:
27
27
  def __init__(
28
- self, project_name: str, api_version: str, job_name: Optional[str] = None
28
+ self,
29
+ project_name: str,
30
+ api_version: str,
31
+ job_name: Optional[str] = None,
32
+ session: Optional[Session] = None,
29
33
  ) -> None:
30
34
  config = get_conf_from_file()
31
35
  if project_name in config:
@@ -76,7 +80,7 @@ class APIConf:
76
80
  #
77
81
  # Retry settings
78
82
  #
79
- self.session = Session()
83
+ self.session = session or Session()
80
84
  retries = Retry(
81
85
  total=3,
82
86
  backoff_factor=0.1,
@@ -84,21 +88,23 @@ class APIConf:
84
88
  allowed_methods=Retry.DEFAULT_ALLOWED_METHODS | {"POST"},
85
89
  )
86
90
  # Default connect timeout set to a small value above the default 3s for TCP
87
- # Default read timeout a bit aggressive to ensure snappy experience
91
+ # Default read timeout a typical value. Does not scale when too aggressive
88
92
  # (note: read timeout is between byte sent, not the whole read)
89
- self.request_timeout = (3.03, 7)
93
+ self.request_timeout = (3.03, 27)
90
94
  self.session.mount("https://", HTTPAdapter(max_retries=retries))
91
95
 
92
96
  @contextmanager
93
97
  def _api(self):
94
98
  try:
95
99
  yield self.session
96
- except ConnectionError:
100
+ except ConnectionError as e:
97
101
  raise click.ClickException(
98
102
  localise(
99
- "Unable to interact with the Artefacts API at this time. "
100
- "Our apologies, this looks like us. Please retry "
101
- "later, or perhaps confirm your internet connectivity."
103
+ "Unable to complete the operation: Network error.\n"
104
+ "This may be a problem with an Artefacts server, or your network.\n"
105
+ "Please try again in a moment or confirm your internet connection.\n"
106
+ "If the problem persists, please contact us (info@artefacts.com)!\n"
107
+ f"All we know: {e}"
102
108
  )
103
109
  )
104
110
 
@@ -173,13 +179,16 @@ class APIConf:
173
179
 
174
180
  Note this is temporary helper, as we expect to turn files as
175
181
  first-order resource at the API level, so move to CRUD model, etc.
182
+
183
+ This facility disables all timeouts, as uploads can be very
184
+ long, and we'd better wait.
176
185
  """
177
186
  with self._api() as session:
178
187
  return session.post(
179
188
  url,
180
189
  data=data,
181
190
  files=files,
182
- timeout=self.request_timeout,
191
+ timeout=None,
183
192
  )
184
193
 
185
194
  def direct(self, verb: str) -> Callable:
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: artefacts 0.9.4.dev18\n"
9
+ "Project-Id-Version: artefacts 0.9.5.dev7\n"
10
10
  "Report-Msgid-Bugs-To: dev@artefacts.com\n"
11
- "POT-Creation-Date: 2025-06-18 09:50+0900\n"
11
+ "POT-Creation-Date: 2025-06-24 09:46+0900\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -22,33 +22,33 @@ msgstr ""
22
22
  msgid "Could not determine package version: {error_message}. Default to 0.0.0"
23
23
  msgstr ""
24
24
 
25
- #: artefacts/cli/__init__.py:97
25
+ #: artefacts/cli/__init__.py:98
26
26
  #, python-brace-format
27
27
  msgid "Error on job creation: {status_code}"
28
28
  msgstr ""
29
29
 
30
- #: artefacts/cli/__init__.py:170
30
+ #: artefacts/cli/__init__.py:172
31
31
  #, python-brace-format
32
32
  msgid "Error on scenario creation: {status_code}"
33
33
  msgstr ""
34
34
 
35
- #: artefacts/cli/__init__.py:279
35
+ #: artefacts/cli/__init__.py:281
36
36
  msgid ""
37
37
  "Files generated by the job are not uploaded to Artefacts, including the "
38
38
  "ones specified in output_dirs"
39
39
  msgstr ""
40
40
 
41
- #: artefacts/cli/__init__.py:291
41
+ #: artefacts/cli/__init__.py:293
42
42
  #, python-brace-format
43
43
  msgid "Uploading {file_name} ({file_size:.2f} MB)"
44
44
  msgstr ""
45
45
 
46
- #: artefacts/cli/__init__.py:302
46
+ #: artefacts/cli/__init__.py:304
47
47
  #, python-brace-format
48
48
  msgid "File too large: {file_name} could not be uploaded"
49
49
  msgstr ""
50
50
 
51
- #: artefacts/cli/__init__.py:310
51
+ #: artefacts/cli/__init__.py:312
52
52
  #, python-brace-format
53
53
  msgid "Error uploading {file_name}: {error_message}, skipping"
54
54
  msgstr ""
@@ -424,21 +424,22 @@ msgstr ""
424
424
  msgid "Package run failed:"
425
425
  msgstr ""
426
426
 
427
- #: artefacts/cli/config.py:43
427
+ #: artefacts/cli/config.py:47
428
428
  #, python-brace-format
429
429
  msgid "No API KEY set. Please run `artefacts config add {project_name}`"
430
430
  msgstr ""
431
431
 
432
- #: artefacts/cli/config.py:62 artefacts/cli/config.py:70
432
+ #: artefacts/cli/config.py:66 artefacts/cli/config.py:74
433
433
  #, python-brace-format
434
434
  msgid "Connecting to {api_url} using {auth_type}"
435
435
  msgstr ""
436
436
 
437
- #: artefacts/cli/config.py:99
437
+ #: artefacts/cli/config.py:103
438
438
  msgid ""
439
- "Unable to interact with the Artefacts API at this time. Our apologies, "
440
- "this looks like us. Please retry later, or perhaps confirm your internet "
441
- "connectivity."
439
+ "Unable to complete the operation: Network error.\n"
440
+ "This may be a problem with an Artefacts server, or your network.\n"
441
+ "Please try again in a moment or confirm your internet connection.\n"
442
+ "If the problem persists, please contact us (info@artefacts.com)!\n"
442
443
  msgstr ""
443
444
 
444
445
  #: artefacts/cli/ros1.py:55
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: artefacts 0.9.4.dev18\n"
9
+ "Project-Id-Version: artefacts 0.9.5.dev7\n"
10
10
  "Report-Msgid-Bugs-To: dev@artefacts.com\n"
11
- "POT-Creation-Date: 2025-06-18 09:50+0900\n"
11
+ "POT-Creation-Date: 2025-06-24 09:46+0900\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -22,33 +22,33 @@ msgstr ""
22
22
  msgid "Could not determine package version: {error_message}. Default to 0.0.0"
23
23
  msgstr ""
24
24
 
25
- #: artefacts/cli/__init__.py:97
25
+ #: artefacts/cli/__init__.py:98
26
26
  #, python-brace-format
27
27
  msgid "Error on job creation: {status_code}"
28
28
  msgstr ""
29
29
 
30
- #: artefacts/cli/__init__.py:170
30
+ #: artefacts/cli/__init__.py:172
31
31
  #, python-brace-format
32
32
  msgid "Error on scenario creation: {status_code}"
33
33
  msgstr ""
34
34
 
35
- #: artefacts/cli/__init__.py:279
35
+ #: artefacts/cli/__init__.py:281
36
36
  msgid ""
37
37
  "Files generated by the job are not uploaded to Artefacts, including the ones "
38
38
  "specified in output_dirs"
39
39
  msgstr ""
40
40
 
41
- #: artefacts/cli/__init__.py:291
41
+ #: artefacts/cli/__init__.py:293
42
42
  #, python-brace-format
43
43
  msgid "Uploading {file_name} ({file_size:.2f} MB)"
44
44
  msgstr ""
45
45
 
46
- #: artefacts/cli/__init__.py:302
46
+ #: artefacts/cli/__init__.py:304
47
47
  #, python-brace-format
48
48
  msgid "File too large: {file_name} could not be uploaded"
49
49
  msgstr ""
50
50
 
51
- #: artefacts/cli/__init__.py:310
51
+ #: artefacts/cli/__init__.py:312
52
52
  #, python-brace-format
53
53
  msgid "Error uploading {file_name}: {error_message}, skipping"
54
54
  msgstr ""
@@ -421,21 +421,22 @@ msgstr ""
421
421
  msgid "Package run failed:"
422
422
  msgstr ""
423
423
 
424
- #: artefacts/cli/config.py:43
424
+ #: artefacts/cli/config.py:47
425
425
  #, python-brace-format
426
426
  msgid "No API KEY set. Please run `artefacts config add {project_name}`"
427
427
  msgstr ""
428
428
 
429
- #: artefacts/cli/config.py:62 artefacts/cli/config.py:70
429
+ #: artefacts/cli/config.py:66 artefacts/cli/config.py:74
430
430
  #, python-brace-format
431
431
  msgid "Connecting to {api_url} using {auth_type}"
432
432
  msgstr ""
433
433
 
434
- #: artefacts/cli/config.py:99
434
+ #: artefacts/cli/config.py:103
435
435
  msgid ""
436
- "Unable to interact with the Artefacts API at this time. Our apologies, this "
437
- "looks like us. Please retry later, or perhaps confirm your internet "
438
- "connectivity."
436
+ "Unable to complete the operation: Network error.\n"
437
+ "This may be a problem with an Artefacts server, or your network.\n"
438
+ "Please try again in a moment or confirm your internet connection.\n"
439
+ "If the problem persists, please contact us (info@artefacts.com)!\n"
439
440
  msgstr ""
440
441
 
441
442
  #: artefacts/cli/ros1.py:55
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: artefacts 0.9.4.dev18\n"
9
+ "Project-Id-Version: artefacts 0.9.5.dev7\n"
10
10
  "Report-Msgid-Bugs-To: dev@artefacts.com\n"
11
- "POT-Creation-Date: 2025-06-18 09:50+0900\n"
11
+ "POT-Creation-Date: 2025-06-24 09:46+0900\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
artefacts/cli/version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.9.4'
21
- __version_tuple__ = version_tuple = (0, 9, 4)
20
+ __version__ = version = '0.9.5'
21
+ __version_tuple__ = version_tuple = (0, 9, 5)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: artefacts_cli
3
- Version: 0.9.4
3
+ Version: 0.9.5
4
4
  Author-email: FD <fabian@artefacts.com>, AGC <alejandro@artefacts.com>, TN <tomo@artefacts.com>, EP <eric@artefacts.com>
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://github.com/art-e-fact/artefacts-client
@@ -42,6 +42,9 @@ Requires-Dist: python-markdown-math; extra == "dev"
42
42
  Requires-Dist: ruff>=0.9.2; extra == "dev"
43
43
  Requires-Dist: setuptools_scm>=8; extra == "dev"
44
44
  Requires-Dist: twine; extra == "dev"
45
+ Provides-Extra: dev-extended
46
+ Requires-Dist: artefacts_cli[dev]; extra == "dev-extended"
47
+ Requires-Dist: pytest-watch; extra == "dev-extended"
45
48
 
46
49
  # Artefacts CLI
47
50
 
@@ -1,10 +1,10 @@
1
1
  artefacts/__init__.py,sha256=VLmogtpRQeJjQjAORV8ClSJ5qF-57Hxx3apvgy9H1zk,76
2
- artefacts/cli/__init__.py,sha256=jApH1hGuUu4m-XWoCJTcgA2y7esvX9dUo_pYjSycwB8,13075
2
+ artefacts/cli/__init__.py,sha256=Hzr-kXlXhVpBvgstv7MihKgJvBlFnXOTO8xJvfet4ms,13347
3
3
  artefacts/cli/app.py,sha256=7ERkYYZPdrW7RyXjLDqKP7AT3tkWHEDVFL5X1E7llYk,27868
4
4
  artefacts/cli/app_containers.py,sha256=oTWEAIE0m0nQQV7d33q75OL9-Bql0gDEnWGkmgCBnWE,8503
5
5
  artefacts/cli/app_containers.pyi,sha256=3fBxcSppJr6EOEcUojvflG3Eegg7lv2Qp0dNQQILrP4,63
6
6
  artefacts/cli/bagparser.py,sha256=aegvhIgwF-C1giGQWKB-cn0I2fW_iVamFwYm7YkfIyo,3738
7
- artefacts/cli/config.py,sha256=KqPkNaK_qYYndgj8JVlfRcIiAae--i1AphtR43BniS0,7226
7
+ artefacts/cli/config.py,sha256=vYF1H2ICCxIcvfl_seaS2dDqSLSF2OeKbPoI4Y3ogJ4,7562
8
8
  artefacts/cli/constants.py,sha256=l7xoXiKaZIpcn3JFwf5Tf5Kprfmf9x63AUfdTQQ3zGA,435
9
9
  artefacts/cli/errors.py,sha256=BiCRo3IwVjtEotaFtmwsGTZiX-TRE69KqLrEQItLsag,34
10
10
  artefacts/cli/helpers.py,sha256=j8AYj7hAO-ZFCa4FTFqLrjl7JlYQGWWLJvjWkovK2L4,1594
@@ -16,18 +16,18 @@ artefacts/cli/ros1.py,sha256=tE6WK8SQZPPdWwFnOdIDTNv7chhr6AXY53gDYOEHJhY,9995
16
16
  artefacts/cli/ros2.py,sha256=P_IVG8rDYaPsPJKKnwEFer8yI41HEtvtbLf4ymgbj0E,8629
17
17
  artefacts/cli/utils.py,sha256=-lMkPo5UtvnYG1D8NGnbOwO8jT4GXhYuwMxs29A393Q,4239
18
18
  artefacts/cli/utils_ros.py,sha256=lOQSMtcRl3OHZ1t_dpZZnP5YdeydLBlcVNs9h91ZXa4,2845
19
- artefacts/cli/version.py,sha256=8J5e_PpW7gLxApQspc-qNiHqQcX4LYr2ELdH8En2QZE,511
19
+ artefacts/cli/version.py,sha256=zxVCk4aDkddvJzuxXo9pB5-_705BXDXzD2svnbo76Ss,511
20
20
  artefacts/cli/containers/__init__.py,sha256=x3g6nz5TLRtF1bU0mlIN0aDd0Gwv3V3skE1aW9uVK5k,2274
21
21
  artefacts/cli/containers/docker_cm.py,sha256=vOd6qoXc-WEA9ZXDkV-nHF7j5MXmaKFw8bz_qsdakqk,6480
22
22
  artefacts/cli/containers/docker_utils.py,sha256=jGZJy0kapWnFwo5BBudtgI1gY9PXhLTgKCgecNsFUZ8,2966
23
23
  artefacts/cli/containers/utils.py,sha256=O86S4SE-Ajd07f4GnwwFjqGQWu2s-KeB829DkWYJJbQ,2408
24
- artefacts/cli/locales/art.pot,sha256=1arPub-xKIohMcgW6JTIeJxFSMpO__kPXzUObDftTOw,14991
25
- artefacts/cli/locales/base.pot,sha256=gV8U2fy0DsgBUa1FvZ027ZbrBdgaM9DcDVjRWmAE3Tc,28212
26
- artefacts/cli/locales/click.pot,sha256=pAmOnCtnOs776VuxY9LyKYwxT21YglEq5Vt-_e1IC78,13853
24
+ artefacts/cli/locales/art.pot,sha256=E1hAXjBKs822-UULKoW19SKg8ueuuMqj0l5mDHG-4Nc,15086
25
+ artefacts/cli/locales/base.pot,sha256=jp3aUUKMmQsgCeZaNhvika57BP2VuNyUx0JNfeGqF8A,28307
26
+ artefacts/cli/locales/click.pot,sha256=MuTVFNPWTWjmxrDr1jZlgAdgEZSriMgy4bkXYajjsKc,13852
27
27
  artefacts/copava/__init__.py,sha256=Fs90xyrDMq6Av7JnDSeZtu5Y18U5_Sh2cdNBWn5vkBM,45
28
28
  artefacts/wrappers/artefacts_ros1_meta.launch,sha256=9tN7_0xLH8jW27KYFerhF3NuWDx2dED3ks_qoGVZAPw,1412
29
- artefacts_cli-0.9.4.dist-info/METADATA,sha256=YzNJdZHIoY4F-Nq8oAdBLd7HVSzd-5Li6WotiLQpq2Q,3559
30
- artefacts_cli-0.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
- artefacts_cli-0.9.4.dist-info/entry_points.txt,sha256=nlTXRzilNjccbi53FgaRWCQPkG-pv61HRkaCkrKjlec,58
32
- artefacts_cli-0.9.4.dist-info/top_level.txt,sha256=FdaMV1C9m36MWa-2Stm5xVODv7hss_nRYNwR83j_7ow,10
33
- artefacts_cli-0.9.4.dist-info/RECORD,,
29
+ artefacts_cli-0.9.5.dist-info/METADATA,sha256=cmnAttG25oQpGr7vrfa4KnFLoe9vF-ZMQcrEA5A4CFk,3700
30
+ artefacts_cli-0.9.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ artefacts_cli-0.9.5.dist-info/entry_points.txt,sha256=nlTXRzilNjccbi53FgaRWCQPkG-pv61HRkaCkrKjlec,58
32
+ artefacts_cli-0.9.5.dist-info/top_level.txt,sha256=FdaMV1C9m36MWa-2Stm5xVODv7hss_nRYNwR83j_7ow,10
33
+ artefacts_cli-0.9.5.dist-info/RECORD,,