artefacts-cli 0.8.0__py3-none-any.whl → 0.9.1__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 +61 -16
- artefacts/cli/app.py +196 -167
- artefacts/cli/app_containers.py +97 -25
- artefacts/cli/app_containers.pyi +3 -0
- artefacts/cli/bagparser.py +4 -0
- artefacts/cli/config.py +62 -0
- artefacts/cli/constants.py +7 -0
- artefacts/cli/containers/__init__.py +5 -5
- artefacts/cli/containers/docker_cm.py +175 -0
- artefacts/cli/containers/docker_utils.py +98 -0
- artefacts/cli/containers/utils.py +20 -8
- artefacts/cli/helpers.py +55 -0
- artefacts/cli/i18n.py +30 -0
- artefacts/cli/locales/art.pot +524 -0
- artefacts/cli/locales/base.pot +936 -0
- artefacts/cli/locales/click.pot +438 -0
- artefacts/cli/locales/ja_JP/LC_MESSAGES/artefacts.mo +0 -0
- artefacts/cli/other.py +1 -0
- artefacts/cli/ros1.py +21 -6
- artefacts/cli/ros2.py +10 -3
- artefacts/cli/utils.py +8 -4
- artefacts/cli/utils_ros.py +6 -2
- artefacts/cli/version.py +2 -2
- artefacts/copava/__init__.py +1 -0
- {artefacts_cli-0.8.0.dist-info → artefacts_cli-0.9.1.dist-info}/METADATA +10 -3
- artefacts_cli-0.9.1.dist-info/RECORD +34 -0
- {artefacts_cli-0.8.0.dist-info → artefacts_cli-0.9.1.dist-info}/WHEEL +1 -1
- artefacts/cli/containers/docker.py +0 -119
- artefacts_cli-0.8.0.dist-info/RECORD +0 -24
- {artefacts_cli-0.8.0.dist-info → artefacts_cli-0.9.1.dist-info}/entry_points.txt +0 -0
- {artefacts_cli-0.8.0.dist-info → artefacts_cli-0.9.1.dist-info}/top_level.txt +0 -0
artefacts/cli/__init__.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
from datetime import datetime, timezone
|
1
2
|
from importlib.metadata import version, PackageNotFoundError
|
2
|
-
import
|
3
|
+
from typing import Optional
|
4
|
+
import copy
|
3
5
|
import glob
|
4
|
-
|
5
|
-
import os
|
6
|
+
import json
|
6
7
|
import math
|
8
|
+
import os
|
7
9
|
import requests
|
8
|
-
import copy
|
9
|
-
from typing import Optional
|
10
10
|
|
11
|
+
from .config import APIConf
|
12
|
+
from .i18n import localise
|
11
13
|
from .parameters import iter_grid
|
12
14
|
from .logger import logger
|
13
15
|
|
@@ -21,7 +23,13 @@ except PackageNotFoundError:
|
|
21
23
|
|
22
24
|
__version__ = get_version()
|
23
25
|
except Exception as e:
|
24
|
-
logger.warning(
|
26
|
+
logger.warning(
|
27
|
+
localise(
|
28
|
+
"Could not determine package version: {error_message}. Default to 0.0.0".format(
|
29
|
+
error_message=e
|
30
|
+
)
|
31
|
+
)
|
32
|
+
)
|
25
33
|
__version__ = "0.0.0"
|
26
34
|
|
27
35
|
|
@@ -35,7 +43,7 @@ class WarpJob:
|
|
35
43
|
def __init__(
|
36
44
|
self,
|
37
45
|
project_id,
|
38
|
-
api_conf,
|
46
|
+
api_conf: APIConf,
|
39
47
|
jobname,
|
40
48
|
jobconf,
|
41
49
|
dryrun=False,
|
@@ -86,7 +94,13 @@ class WarpJob:
|
|
86
94
|
msg = response.json()["message"]
|
87
95
|
logger.warning(msg)
|
88
96
|
raise AuthenticationError(msg)
|
89
|
-
logger.warning(
|
97
|
+
logger.warning(
|
98
|
+
localise(
|
99
|
+
"Error on job creation: {status_code}".format(
|
100
|
+
status_code=response.status_code
|
101
|
+
)
|
102
|
+
)
|
103
|
+
)
|
90
104
|
logger.warning(response.text)
|
91
105
|
raise AuthenticationError(str(response.status_code))
|
92
106
|
self.job_id = response.json()["job_id"]
|
@@ -133,6 +147,8 @@ class WarpRun:
|
|
133
147
|
self.output_path = self.params.get(
|
134
148
|
"output_path", f"{self.job.output_path}/{self.run_n}"
|
135
149
|
)
|
150
|
+
self.test_results = None
|
151
|
+
self.success = False
|
136
152
|
self.logger = logger
|
137
153
|
os.makedirs(self.output_path, exist_ok=True)
|
138
154
|
data = {
|
@@ -158,7 +174,13 @@ class WarpRun:
|
|
158
174
|
msg = response.json()["message"]
|
159
175
|
self.logger.warning(msg)
|
160
176
|
raise AuthenticationError(msg)
|
161
|
-
self.logger.warning(
|
177
|
+
self.logger.warning(
|
178
|
+
localise(
|
179
|
+
"Error on scenario creation: {status_code}".format(
|
180
|
+
status_code=response.status_code
|
181
|
+
)
|
182
|
+
)
|
183
|
+
)
|
162
184
|
self.logger.warning(response.text)
|
163
185
|
raise AuthenticationError(str(response.status_code))
|
164
186
|
return
|
@@ -236,8 +258,10 @@ class WarpRun:
|
|
236
258
|
|
237
259
|
def stop(self):
|
238
260
|
end = datetime.now(timezone.utc).timestamp()
|
261
|
+
|
239
262
|
if self.job.dryrun:
|
240
263
|
return
|
264
|
+
|
241
265
|
# Log metadata
|
242
266
|
data = {
|
243
267
|
"job_id": self.job.job_id,
|
@@ -248,18 +272,23 @@ class WarpRun:
|
|
248
272
|
"duration": math.ceil(end - self.start),
|
249
273
|
"tests": self.test_results,
|
250
274
|
"success": self.success,
|
251
|
-
"uploads": self.uploads,
|
252
275
|
"metrics": self.metrics,
|
253
276
|
}
|
277
|
+
if not self.job.noupload:
|
278
|
+
data["uploads"] = self.uploads
|
279
|
+
|
254
280
|
response = requests.put(
|
255
281
|
f"{self.job.api_conf.api_url}/{self.job.project_id}/job/{self.job.job_id}/run/{self.run_n}",
|
256
282
|
json=data,
|
257
283
|
headers=self.job.api_conf.headers,
|
258
284
|
)
|
285
|
+
|
259
286
|
# use s3 presigned urls to upload the artifacts
|
260
287
|
if self.job.noupload:
|
261
288
|
print(
|
262
|
-
|
289
|
+
localise(
|
290
|
+
"Files generated by the job are not uploaded to Artefacts, including the ones specified in output_dirs"
|
291
|
+
)
|
263
292
|
)
|
264
293
|
else:
|
265
294
|
upload_urls = response.json()["upload_urls"]
|
@@ -268,7 +297,13 @@ class WarpRun:
|
|
268
297
|
upload_info = upload_urls[key]
|
269
298
|
file_size_mb = os.path.getsize(file_name) / 1024 / 1024
|
270
299
|
try:
|
271
|
-
print(
|
300
|
+
print(
|
301
|
+
localise(
|
302
|
+
"Uploading {file_name} ({file_size:.2f} MB)".format(
|
303
|
+
file_name=file_name, file_size=file_size_mb
|
304
|
+
)
|
305
|
+
)
|
306
|
+
)
|
272
307
|
# TODO: add a retry policy
|
273
308
|
requests.post(
|
274
309
|
upload_info["url"],
|
@@ -277,15 +312,25 @@ class WarpRun:
|
|
277
312
|
)
|
278
313
|
except OverflowError:
|
279
314
|
self.logger.warning(
|
280
|
-
|
315
|
+
localise(
|
316
|
+
"File too large: {file_name} could not be uploaded".format(
|
317
|
+
file_name=file_name
|
318
|
+
)
|
319
|
+
)
|
281
320
|
)
|
282
321
|
except Exception as e:
|
283
|
-
self.logger.warning(
|
322
|
+
self.logger.warning(
|
323
|
+
localise(
|
324
|
+
"Error uploading {file_name}: {error_message}, skipping".format(
|
325
|
+
file_name=file_name, error_message=e
|
326
|
+
)
|
327
|
+
)
|
328
|
+
)
|
284
329
|
|
285
330
|
|
286
331
|
def init_job(
|
287
332
|
project_id: str,
|
288
|
-
|
333
|
+
api_conf: APIConf,
|
289
334
|
jobname: str,
|
290
335
|
jobconf: dict,
|
291
336
|
dryrun: bool = False,
|
@@ -297,7 +342,7 @@ def init_job(
|
|
297
342
|
):
|
298
343
|
return WarpJob(
|
299
344
|
project_id,
|
300
|
-
|
345
|
+
api_conf,
|
301
346
|
jobname,
|
302
347
|
jobconf,
|
303
348
|
dryrun,
|