From 2b03ed18894cd41870d5b410cbf0d6ee2da0e035 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 12 Feb 2025 11:11:45 +0000 Subject: [PATCH 01/20] Fixed missing start and end times --- simvue/run.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/simvue/run.py b/simvue/run.py index af7a5aa0..f67117b5 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -465,12 +465,13 @@ def _start(self, reconnect: bool = False) -> bool: logger.debug("Starting run") + self._start_time = time.time() + if self._sv_obj: self._sv_obj.status = self._status + self._sv_obj.started = self._start_time self._sv_obj.commit() - self._start_time = time.time() - if self._pid == 0: self._pid = os.getpid() @@ -1459,7 +1460,7 @@ def set_status( ) -> bool: """Set run status - status to assign to this run + status to assign to this run once finished Parameters ---------- @@ -1479,6 +1480,7 @@ def set_status( if self._sv_obj: self._sv_obj.status = status + self._sv_obj.endtime = time.time() self._sv_obj.commit() return True From 15314973c8175c772594ab229cf5a896a9b2cd1c Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 12 Feb 2025 11:45:53 +0000 Subject: [PATCH 02/20] Fixed offline file artifact path --- simvue/api/objects/artifact/file.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/simvue/api/objects/artifact/file.py b/simvue/api/objects/artifact/file.py index 7878d514..54f0a8cb 100644 --- a/simvue/api/objects/artifact/file.py +++ b/simvue/api/objects/artifact/file.py @@ -52,14 +52,15 @@ def new( if _mime_type not in get_mimetypes(): raise ValueError(f"Invalid MIME type '{mime_type}' specified") - file_path = pathlib.Path(file_path) - _file_size = file_path.stat().st_size - _file_orig_path = file_path.expanduser().absolute() - _file_checksum = calculate_sha256(f"{file_path}", is_file=True) - kwargs.pop("original_path", None) - kwargs.pop("size", None) - kwargs.pop("checksum", None) + if _file_orig_path := kwargs.pop("original_path", None): + _file_size = kwargs.pop("size") + _file_checksum = kwargs.pop("checksum") + else: + file_path = pathlib.Path(file_path) + _file_size = file_path.stat().st_size + _file_orig_path = file_path.expanduser().absolute() + _file_checksum = calculate_sha256(f"{file_path}", is_file=True) _artifact = FileArtifact( name=name, From c1ab236fa94126647c49070feddb386f9cbbeaa3 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 12 Feb 2025 13:16:31 +0000 Subject: [PATCH 03/20] Loosen numpy requirement --- poetry.lock | 108 ++++++++++++++++++++++--------------------------- pyproject.toml | 2 +- 2 files changed, 49 insertions(+), 61 deletions(-) diff --git a/poetry.lock b/poetry.lock index aa295ce7..ed8390cd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -505,7 +505,6 @@ files = [ {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:761817a3377ef15ac23cd7834715081791d4ec77f9297ee694ca1ee9c2c7e5eb"}, {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:3c672a53c0fb4725a29c303be906d3c1fa99c32f58abe008a82705f9ee96f40b"}, {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:4ac4c9f37eba52cb6fbeaf5b59c152ea976726b865bd4cf87883a7e7006cc543"}, - {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:60eb32934076fa07e4316b7b2742fa52cbb190b42c2df2863dbc4230a0a9b385"}, {file = "cryptography-44.0.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ed3534eb1090483c96178fcb0f8893719d96d5274dfde98aa6add34614e97c8e"}, {file = "cryptography-44.0.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:f3f6fdfa89ee2d9d496e2c087cebef9d4fcbb0ad63c40e821b39f74bf48d9c5e"}, {file = "cryptography-44.0.0-cp37-abi3-win32.whl", hash = "sha256:eb33480f1bad5b78233b0ad3e1b0be21e8ef1da745d8d2aecbb20671658b9053"}, @@ -516,7 +515,6 @@ files = [ {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:c5eb858beed7835e5ad1faba59e865109f3e52b3783b9ac21e7e47dc5554e289"}, {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f53c2c87e0fb4b0c00fa9571082a057e37690a8f12233306161c8f4b819960b7"}, {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:9e6fc8a08e116fb7c7dd1f040074c9d7b51d74a8ea40d4df2fc7aa08b76b9e6c"}, - {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9abcc2e083cbe8dde89124a47e5e53ec38751f0d7dfd36801008f316a127d7ba"}, {file = "cryptography-44.0.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:d2436114e46b36d00f8b72ff57e598978b37399d2786fd39793c36c6d5cb1c64"}, {file = "cryptography-44.0.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a01956ddfa0a6790d594f5b34fc1bfa6098aca434696a03cfdbe469b8ed79285"}, {file = "cryptography-44.0.0-cp39-abi3-win32.whl", hash = "sha256:eca27345e1214d1b9f9490d200f9db5a874479be914199194e746c893788d417"}, @@ -1329,68 +1327,58 @@ pyspark = ["pyspark (>=3.5.0)"] [[package]] name = "numpy" -version = "2.2.2" +version = "2.0.2" description = "Fundamental package for array computing in Python" optional = false -python-versions = ">=3.10" +python-versions = ">=3.9" groups = ["main"] markers = "python_version <= \"3.11\" or python_version >= \"3.12\"" files = [ - {file = "numpy-2.2.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7079129b64cb78bdc8d611d1fd7e8002c0a2565da6a47c4df8062349fee90e3e"}, - {file = "numpy-2.2.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2ec6c689c61df613b783aeb21f945c4cbe6c51c28cb70aae8430577ab39f163e"}, - {file = "numpy-2.2.2-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:40c7ff5da22cd391944a28c6a9c638a5eef77fcf71d6e3a79e1d9d9e82752715"}, - {file = "numpy-2.2.2-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:995f9e8181723852ca458e22de5d9b7d3ba4da3f11cc1cb113f093b271d7965a"}, - {file = "numpy-2.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b78ea78450fd96a498f50ee096f69c75379af5138f7881a51355ab0e11286c97"}, - {file = "numpy-2.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3fbe72d347fbc59f94124125e73fc4976a06927ebc503ec5afbfb35f193cd957"}, - {file = "numpy-2.2.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:8e6da5cffbbe571f93588f562ed130ea63ee206d12851b60819512dd3e1ba50d"}, - {file = "numpy-2.2.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:09d6a2032faf25e8d0cadde7fd6145118ac55d2740132c1d845f98721b5ebcfd"}, - {file = "numpy-2.2.2-cp310-cp310-win32.whl", hash = "sha256:159ff6ee4c4a36a23fe01b7c3d07bd8c14cc433d9720f977fcd52c13c0098160"}, - {file = "numpy-2.2.2-cp310-cp310-win_amd64.whl", hash = "sha256:64bd6e1762cd7f0986a740fee4dff927b9ec2c5e4d9a28d056eb17d332158014"}, - {file = "numpy-2.2.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:642199e98af1bd2b6aeb8ecf726972d238c9877b0f6e8221ee5ab945ec8a2189"}, - {file = "numpy-2.2.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6d9fc9d812c81e6168b6d405bf00b8d6739a7f72ef22a9214c4241e0dc70b323"}, - {file = "numpy-2.2.2-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:c7d1fd447e33ee20c1f33f2c8e6634211124a9aabde3c617687d8b739aa69eac"}, - {file = "numpy-2.2.2-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:451e854cfae0febe723077bd0cf0a4302a5d84ff25f0bfece8f29206c7bed02e"}, - {file = "numpy-2.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd249bc894af67cbd8bad2c22e7cbcd46cf87ddfca1f1289d1e7e54868cc785c"}, - {file = "numpy-2.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:02935e2c3c0c6cbe9c7955a8efa8908dd4221d7755644c59d1bba28b94fd334f"}, - {file = "numpy-2.2.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:a972cec723e0563aa0823ee2ab1df0cb196ed0778f173b381c871a03719d4826"}, - {file = "numpy-2.2.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d6d6a0910c3b4368d89dde073e630882cdb266755565155bc33520283b2d9df8"}, - {file = "numpy-2.2.2-cp311-cp311-win32.whl", hash = "sha256:860fd59990c37c3ef913c3ae390b3929d005243acca1a86facb0773e2d8d9e50"}, - {file = "numpy-2.2.2-cp311-cp311-win_amd64.whl", hash = "sha256:da1eeb460ecce8d5b8608826595c777728cdf28ce7b5a5a8c8ac8d949beadcf2"}, - {file = "numpy-2.2.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ac9bea18d6d58a995fac1b2cb4488e17eceeac413af014b1dd26170b766d8467"}, - {file = "numpy-2.2.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:23ae9f0c2d889b7b2d88a3791f6c09e2ef827c2446f1c4a3e3e76328ee4afd9a"}, - {file = "numpy-2.2.2-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:3074634ea4d6df66be04f6728ee1d173cfded75d002c75fac79503a880bf3825"}, - {file = "numpy-2.2.2-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:8ec0636d3f7d68520afc6ac2dc4b8341ddb725039de042faf0e311599f54eb37"}, - {file = "numpy-2.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2ffbb1acd69fdf8e89dd60ef6182ca90a743620957afb7066385a7bbe88dc748"}, - {file = "numpy-2.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0349b025e15ea9d05c3d63f9657707a4e1d471128a3b1d876c095f328f8ff7f0"}, - {file = "numpy-2.2.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:463247edcee4a5537841d5350bc87fe8e92d7dd0e8c71c995d2c6eecb8208278"}, - {file = "numpy-2.2.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:9dd47ff0cb2a656ad69c38da850df3454da88ee9a6fde0ba79acceee0e79daba"}, - {file = "numpy-2.2.2-cp312-cp312-win32.whl", hash = "sha256:4525b88c11906d5ab1b0ec1f290996c0020dd318af8b49acaa46f198b1ffc283"}, - {file = "numpy-2.2.2-cp312-cp312-win_amd64.whl", hash = "sha256:5acea83b801e98541619af398cc0109ff48016955cc0818f478ee9ef1c5c3dcb"}, - {file = "numpy-2.2.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b208cfd4f5fe34e1535c08983a1a6803fdbc7a1e86cf13dd0c61de0b51a0aadc"}, - {file = "numpy-2.2.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:d0bbe7dd86dca64854f4b6ce2ea5c60b51e36dfd597300057cf473d3615f2369"}, - {file = "numpy-2.2.2-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:22ea3bb552ade325530e72a0c557cdf2dea8914d3a5e1fecf58fa5dbcc6f43cd"}, - {file = "numpy-2.2.2-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:128c41c085cab8a85dc29e66ed88c05613dccf6bc28b3866cd16050a2f5448be"}, - {file = "numpy-2.2.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:250c16b277e3b809ac20d1f590716597481061b514223c7badb7a0f9993c7f84"}, - {file = "numpy-2.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0c8854b09bc4de7b041148d8550d3bd712b5c21ff6a8ed308085f190235d7ff"}, - {file = "numpy-2.2.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b6fb9c32a91ec32a689ec6410def76443e3c750e7cfc3fb2206b985ffb2b85f0"}, - {file = "numpy-2.2.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:57b4012e04cc12b78590a334907e01b3a85efb2107df2b8733ff1ed05fce71de"}, - {file = "numpy-2.2.2-cp313-cp313-win32.whl", hash = "sha256:4dbd80e453bd34bd003b16bd802fac70ad76bd463f81f0c518d1245b1c55e3d9"}, - {file = "numpy-2.2.2-cp313-cp313-win_amd64.whl", hash = "sha256:5a8c863ceacae696aff37d1fd636121f1a512117652e5dfb86031c8d84836369"}, - {file = "numpy-2.2.2-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:b3482cb7b3325faa5f6bc179649406058253d91ceda359c104dac0ad320e1391"}, - {file = "numpy-2.2.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:9491100aba630910489c1d0158034e1c9a6546f0b1340f716d522dc103788e39"}, - {file = "numpy-2.2.2-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:41184c416143defa34cc8eb9d070b0a5ba4f13a0fa96a709e20584638254b317"}, - {file = "numpy-2.2.2-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:7dca87ca328f5ea7dafc907c5ec100d187911f94825f8700caac0b3f4c384b49"}, - {file = "numpy-2.2.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0bc61b307655d1a7f9f4b043628b9f2b721e80839914ede634e3d485913e1fb2"}, - {file = "numpy-2.2.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fad446ad0bc886855ddf5909cbf8cb5d0faa637aaa6277fb4b19ade134ab3c7"}, - {file = "numpy-2.2.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:149d1113ac15005652e8d0d3f6fd599360e1a708a4f98e43c9c77834a28238cb"}, - {file = "numpy-2.2.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:106397dbbb1896f99e044efc90360d098b3335060375c26aa89c0d8a97c5f648"}, - {file = "numpy-2.2.2-cp313-cp313t-win32.whl", hash = "sha256:0eec19f8af947a61e968d5429f0bd92fec46d92b0008d0a6685b40d6adf8a4f4"}, - {file = "numpy-2.2.2-cp313-cp313t-win_amd64.whl", hash = "sha256:97b974d3ba0fb4612b77ed35d7627490e8e3dff56ab41454d9e8b23448940576"}, - {file = "numpy-2.2.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:b0531f0b0e07643eb089df4c509d30d72c9ef40defa53e41363eca8a8cc61495"}, - {file = "numpy-2.2.2-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:e9e82dcb3f2ebbc8cb5ce1102d5f1c5ed236bf8a11730fb45ba82e2841ec21df"}, - {file = "numpy-2.2.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0d4142eb40ca6f94539e4db929410f2a46052a0fe7a2c1c59f6179c39938d2a"}, - {file = "numpy-2.2.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:356ca982c188acbfa6af0d694284d8cf20e95b1c3d0aefa8929376fea9146f60"}, - {file = "numpy-2.2.2.tar.gz", hash = "sha256:ed6906f61834d687738d25988ae117683705636936cc605be0bb208b23df4d8f"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:51129a29dbe56f9ca83438b706e2e69a39892b5eda6cedcb6b0c9fdc9b0d3ece"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f15975dfec0cf2239224d80e32c3170b1d168335eaedee69da84fbe9f1f9cd04"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:8c5713284ce4e282544c68d1c3b2c7161d38c256d2eefc93c1d683cf47683e66"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:becfae3ddd30736fe1889a37f1f580e245ba79a5855bff5f2a29cb3ccc22dd7b"}, + {file = "numpy-2.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2da5960c3cf0df7eafefd806d4e612c5e19358de82cb3c343631188991566ccd"}, + {file = "numpy-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:496f71341824ed9f3d2fd36cf3ac57ae2e0165c143b55c3a035ee219413f3318"}, + {file = "numpy-2.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a61ec659f68ae254e4d237816e33171497e978140353c0c2038d46e63282d0c8"}, + {file = "numpy-2.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d731a1c6116ba289c1e9ee714b08a8ff882944d4ad631fd411106a30f083c326"}, + {file = "numpy-2.0.2-cp310-cp310-win32.whl", hash = "sha256:984d96121c9f9616cd33fbd0618b7f08e0cfc9600a7ee1d6fd9b239186d19d97"}, + {file = "numpy-2.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:c7b0be4ef08607dd04da4092faee0b86607f111d5ae68036f16cc787e250a131"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:49ca4decb342d66018b01932139c0961a8f9ddc7589611158cb3c27cbcf76448"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:11a76c372d1d37437857280aa142086476136a8c0f373b2e648ab2c8f18fb195"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:807ec44583fd708a21d4a11d94aedf2f4f3c3719035c76a2bbe1fe8e217bdc57"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:8cafab480740e22f8d833acefed5cc87ce276f4ece12fdaa2e8903db2f82897a"}, + {file = "numpy-2.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a15f476a45e6e5a3a79d8a14e62161d27ad897381fecfa4a09ed5322f2085669"}, + {file = "numpy-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13e689d772146140a252c3a28501da66dfecd77490b498b168b501835041f951"}, + {file = "numpy-2.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9ea91dfb7c3d1c56a0e55657c0afb38cf1eeae4544c208dc465c3c9f3a7c09f9"}, + {file = "numpy-2.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c1c9307701fec8f3f7a1e6711f9089c06e6284b3afbbcd259f7791282d660a15"}, + {file = "numpy-2.0.2-cp311-cp311-win32.whl", hash = "sha256:a392a68bd329eafac5817e5aefeb39038c48b671afd242710b451e76090e81f4"}, + {file = "numpy-2.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:286cd40ce2b7d652a6f22efdfc6d1edf879440e53e76a75955bc0c826c7e64dc"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:df55d490dea7934f330006d0f81e8551ba6010a5bf035a249ef61a94f21c500b"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8df823f570d9adf0978347d1f926b2a867d5608f434a7cff7f7908c6570dcf5e"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:9a92ae5c14811e390f3767053ff54eaee3bf84576d99a2456391401323f4ec2c"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:a842d573724391493a97a62ebbb8e731f8a5dcc5d285dfc99141ca15a3302d0c"}, + {file = "numpy-2.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c05e238064fc0610c840d1cf6a13bf63d7e391717d247f1bf0318172e759e692"}, + {file = "numpy-2.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a"}, + {file = "numpy-2.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:96a55f64139912d61de9137f11bf39a55ec8faec288c75a54f93dfd39f7eb40c"}, + {file = "numpy-2.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ec9852fb39354b5a45a80bdab5ac02dd02b15f44b3804e9f00c556bf24b4bded"}, + {file = "numpy-2.0.2-cp312-cp312-win32.whl", hash = "sha256:671bec6496f83202ed2d3c8fdc486a8fc86942f2e69ff0e986140339a63bcbe5"}, + {file = "numpy-2.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:cfd41e13fdc257aa5778496b8caa5e856dc4896d4ccf01841daee1d96465467a"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9059e10581ce4093f735ed23f3b9d283b9d517ff46009ddd485f1747eb22653c"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:423e89b23490805d2a5a96fe40ec507407b8ee786d66f7328be214f9679df6dd"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_14_0_arm64.whl", hash = "sha256:2b2955fa6f11907cf7a70dab0d0755159bca87755e831e47932367fc8f2f2d0b"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_14_0_x86_64.whl", hash = "sha256:97032a27bd9d8988b9a97a8c4d2c9f2c15a81f61e2f21404d7e8ef00cb5be729"}, + {file = "numpy-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e795a8be3ddbac43274f18588329c72939870a16cae810c2b73461c40718ab1"}, + {file = "numpy-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f26b258c385842546006213344c50655ff1555a9338e2e5e02a0756dc3e803dd"}, + {file = "numpy-2.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fec9451a7789926bcf7c2b8d187292c9f93ea30284802a0ab3f5be8ab36865d"}, + {file = "numpy-2.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:9189427407d88ff25ecf8f12469d4d39d35bee1db5d39fc5c168c6f088a6956d"}, + {file = "numpy-2.0.2-cp39-cp39-win32.whl", hash = "sha256:905d16e0c60200656500c95b6b8dca5d109e23cb24abc701d41c02d74c6b3afa"}, + {file = "numpy-2.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:a3f4ab0caa7f053f6797fcd4e1e25caee367db3112ef2b6ef82d749530768c73"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:7f0a0c6f12e07fa94133c8a67404322845220c06a9e80e85999afe727f7438b8"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-macosx_14_0_x86_64.whl", hash = "sha256:312950fdd060354350ed123c0e25a71327d3711584beaef30cdaa93320c392d4"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26df23238872200f63518dd2aa984cfca675d82469535dc7162dc2ee52d9dd5c"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a46288ec55ebbd58947d31d72be2c63cbf839f0a63b49cb755022310792a3385"}, + {file = "numpy-2.0.2.tar.gz", hash = "sha256:883c987dee1880e2a864ab0dc9892292582510604156762362d9326444636e78"}, ] [[package]] @@ -2636,4 +2624,4 @@ plot = ["matplotlib", "plotly"] [metadata] lock-version = "2.1" python-versions = ">=3.10,<3.14" -content-hash = "b87307deab6d125136242de2adc36049337970d6abea23392c9fdf57761230a6" +content-hash = "d9a431e414844f95182814d46eed5988be22352ac728a0693f8e1fcffb0aa351" diff --git a/pyproject.toml b/pyproject.toml index bbbfd633..c4264a0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ dependencies = [ "humanfriendly (>=10.0,<11.0)", "randomname (>=0.2.1,<0.3.0)", "codecarbon (>=2.8.3,<3.0.0)", - "numpy (>=2.2.2,<3.0.0)", + "numpy (>=2.0.0,<3.0.0)", "flatdict (>=4.0.1,<5.0.0)", "semver (>=3.0.4,<4.0.0)", "email-validator (>=2.2.0,<3.0.0)", From 9f8ba81497b6786c8e12aefaacd02eb460397e60 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 12 Feb 2025 14:22:58 +0000 Subject: [PATCH 04/20] Make timestamp validation in utilities consistent --- simvue/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simvue/utilities.py b/simvue/utilities.py index 69a8ecd8..df9e80b1 100644 --- a/simvue/utilities.py +++ b/simvue/utilities.py @@ -357,7 +357,7 @@ def validate_timestamp(timestamp): Validate a user-provided timestamp """ try: - datetime.datetime.strptime(timestamp, "%Y-%m-%d %H:%M:%S.%f") + datetime.datetime.strptime(timestamp, DATETIME_FORMAT) except ValueError: return False From 8e317593f72ad61170079755f8a5c9dee792934e Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 12 Feb 2025 15:03:20 +0000 Subject: [PATCH 05/20] Added missing runtime attribute to Run --- simvue/api/objects/run.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simvue/api/objects/run.py b/simvue/api/objects/run.py index 9841ded5..f218bbff 100644 --- a/simvue/api/objects/run.py +++ b/simvue/api/objects/run.py @@ -251,6 +251,13 @@ def created(self) -> datetime.datetime | None: datetime.datetime.strptime(_created, DATETIME_FORMAT) if _created else None ) + @property + @staging_check + def runtime(self) -> datetime.datetime | None: + """Retrieve created datetime for the run""" + _runtime: str | None = self._get_attribute("runtime") + return datetime.datetime.strptime(_runtime, "%H:%M:%S.%f") if _runtime else None + @property @staging_check def started(self) -> datetime.datetime | None: From d17678724f9c47d35c1b053d9ad4e61d1df63977 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 12 Feb 2025 15:05:48 +0000 Subject: [PATCH 06/20] Use time not datetime --- simvue/api/objects/run.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simvue/api/objects/run.py b/simvue/api/objects/run.py index f218bbff..08262dd0 100644 --- a/simvue/api/objects/run.py +++ b/simvue/api/objects/run.py @@ -11,6 +11,7 @@ import typing import pydantic import datetime +import time try: from typing import Self @@ -256,7 +257,7 @@ def created(self) -> datetime.datetime | None: def runtime(self) -> datetime.datetime | None: """Retrieve created datetime for the run""" _runtime: str | None = self._get_attribute("runtime") - return datetime.datetime.strptime(_runtime, "%H:%M:%S.%f") if _runtime else None + return time.strptime(_runtime, "%H:%M:%S.%f") if _runtime else None @property @staging_check From 21d0f0c0ba2d89df9c0351e462785e3124606ba5 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 12 Feb 2025 16:54:28 +0000 Subject: [PATCH 07/20] Improved get_artifacts_as_files test --- tests/functional/test_client.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/functional/test_client.py b/tests/functional/test_client.py index 3b6c6f24..37c1a1ae 100644 --- a/tests/functional/test_client.py +++ b/tests/functional/test_client.py @@ -145,12 +145,21 @@ def test_get_artifacts_as_files( create_test_run[1]["run_id"], category=category, output_dir=tempd ) files = [os.path.basename(i) for i in glob.glob(os.path.join(tempd, "*"))] - if not category or category == "input": - assert create_test_run[1]["file_1"] in files - if not category or category == "output": - assert create_test_run[1]["file_2"] in files - if not category or category == "code": - assert create_test_run[1]["file_3"] in files + + if not category: + expected_files = ["file_1", "file_2", "file_3"] + elif category == "input": + expected_files = ["file_1"] + elif category == "output": + expected_files = ["file_2"] + elif category == "code": + expected_files = ["file_3"] + + for file in ["file_1", "file_2", "file_3"]: + if file in expected_files: + assert create_test_run[1][file] in files + else: + assert create_test_run[1][file] not in files @pytest.mark.dependency From cd80cda4fac74232df8d763356790eb5db958c5e Mon Sep 17 00:00:00 2001 From: Matt Field Date: Thu, 13 Feb 2025 09:43:14 +0000 Subject: [PATCH 08/20] Added new from_run method to Artifact and fixed client --- simvue/api/objects/artifact/fetch.py | 51 +++++++++++++++++++--------- simvue/client.py | 6 ++-- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/simvue/api/objects/artifact/fetch.py b/simvue/api/objects/artifact/fetch.py index 88f582ce..d7b163ca 100644 --- a/simvue/api/objects/artifact/fetch.py +++ b/simvue/api/objects/artifact/fetch.py @@ -23,6 +23,37 @@ def __new__(cls, identifier: str | None = None, **kwargs): else: return ObjectArtifact(identifier=identifier, **kwargs) + @classmethod + def from_run( + cls, + run_id: str, + category: typing.Literal["input", "output", "code"] | None = None, + **kwargs, + ) -> typing.Generator[tuple[str, FileArtifact | ObjectArtifact], None, None]: + _temp = ArtifactBase(**kwargs) + _url = URL(_temp._user_config.server.url) / f"runs/{run_id}/artifacts" + _response = sv_get( + url=f"{_url}", params={"category": category}, headers=_temp._headers + ) + _json_response = get_json_from_response( + expected_type=list, + response=_response, + expected_status=[http.HTTPStatus.OK, http.HTTPStatus.NOT_FOUND], + scenario=f"Retrieval of artifacts for run '{run_id}'", + ) + + if _response.status_code == http.HTTPStatus.NOT_FOUND or not _json_response: + raise ObjectNotFoundError( + _temp._label, category, extra=f"for run '{run_id}'" + ) + + for _entry in _json_response: + _id = _entry.pop("id") + yield ( + _id, + Artifact(_local=True, _read_only=True, identifier=_id, **_entry), + ) + @classmethod def from_name( cls, run_id: str, name: str, **kwargs @@ -99,21 +130,9 @@ def get( if (_data := _json_response.get("data")) is None: raise RuntimeError(f"Expected key 'data' for retrieval of {_label}s") - _out_dict: dict[str, FileArtifact | ObjectArtifact] = {} - for _entry in _data: _id = _entry.pop("id") - if _entry["original_path"]: - yield ( - _id, - FileArtifact( - _local=True, _read_only=True, identifier=_id, **_entry - ), - ) - else: - yield ( - _id, - ObjectArtifact( - _local=True, _read_only=True, identifier=_id, **_entry - ), - ) + yield ( + _id, + Artifact(_local=True, _read_only=True, identifier=_id, **_entry), + ) diff --git a/simvue/client.py b/simvue/client.py index 45f152c5..c8e7979e 100644 --- a/simvue/client.py +++ b/simvue/client.py @@ -590,9 +590,9 @@ def get_artifacts_as_files( RuntimeError if there was a failure retrieving artifacts from the server """ - _artifacts: typing.Generator[tuple[str, Artifact], None, None] = Artifact.get( - runs=json.dumps([run_id]), category=category - ) # type: ignore + _artifacts: typing.Generator[tuple[str, Artifact], None, None] = ( + Artifact.from_run(run_id=run_id, category=category) + ) with ThreadPoolExecutor(CONCURRENT_DOWNLOADS) as executor: futures = [ From 6f7c16c6d3764121e679c36873faab620a76d4e0 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Thu, 13 Feb 2025 10:32:17 +0000 Subject: [PATCH 09/20] Add docstrings to new artifact methods --- simvue/api/objects/artifact/fetch.py | 25 +++++++++++++++++++++++++ simvue/client.py | 11 ++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/simvue/api/objects/artifact/fetch.py b/simvue/api/objects/artifact/fetch.py index d7b163ca..1d571266 100644 --- a/simvue/api/objects/artifact/fetch.py +++ b/simvue/api/objects/artifact/fetch.py @@ -30,6 +30,31 @@ def from_run( category: typing.Literal["input", "output", "code"] | None = None, **kwargs, ) -> typing.Generator[tuple[str, FileArtifact | ObjectArtifact], None, None]: + """Return artifacts associated with a given run. + + Parameters + ---------- + run_id : str + The ID of the run to retriece artifacts from + category : typing.Literal["input", "output", "code"] | None, optional + The category of artifacts to return, by default all artifacts are returned + + Returns + ------- + typing.Generator[tuple[str, FileArtifact | ObjectArtifact], None, None] + The artifacts + + Yields + ------ + Iterator[typing.Generator[tuple[str, FileArtifact | ObjectArtifact], None, None]] + identifier for artifact + the artifact itself as a class instance + + Raises + ------ + ObjectNotFoundError + Raised if artifacts could not be found for that run + """ _temp = ArtifactBase(**kwargs) _url = URL(_temp._user_config.server.url) / f"runs/{run_id}/artifacts" _response = sv_get( diff --git a/simvue/client.py b/simvue/client.py index c8e7979e..df01159a 100644 --- a/simvue/client.py +++ b/simvue/client.py @@ -565,9 +565,6 @@ def get_artifacts_as_files( run_id: str, category: typing.Literal["input", "output", "code"] | None = None, output_dir: pydantic.DirectoryPath | None = None, - startswith: str | None = None, - contains: str | None = None, - endswith: str | None = None, ) -> None: """Retrieve artifacts from the given run as a set of files @@ -575,15 +572,11 @@ def get_artifacts_as_files( ---------- run_id : str the unique identifier for the run + category : typing.Literal["input", "output", "code"] | + the type of files to retrieve output_dir : str | None, optional location to download files to, the default of None will download them to the current working directory - startswith : str, optional - only download artifacts with this prefix in their name, by default None - contains : str, optional - only download artifacts containing this term in their name, by default None - endswith : str, optional - only download artifacts ending in this term in their name, by default None Raises ------ From 5a69cb1ec4173712c8faca844a2a54e73a7ddd10 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Thu, 13 Feb 2025 11:10:44 +0000 Subject: [PATCH 10/20] Fix hierarchical artifact download --- simvue/client.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/simvue/client.py b/simvue/client.py index df01159a..c69e6b3a 100644 --- a/simvue/client.py +++ b/simvue/client.py @@ -9,7 +9,6 @@ import contextlib import json import logging -import os import pathlib import typing import http @@ -45,12 +44,9 @@ def _download_artifact_to_file( artifact: Artifact, output_dir: pathlib.Path | None ) -> None: - try: - _file_name = os.path.basename(artifact.name) - except AttributeError: - _file_name = os.path.basename(artifact) - _output_file = (output_dir or pathlib.Path.cwd()).joinpath(_file_name) - + _output_file = (output_dir or pathlib.Path.cwd()).joinpath(artifact.name) + # If this is a hierarchical structure being downloaded, need to create directories + _output_file.parent.mkdir(parents=True, exist_ok=True) with _output_file.open("wb") as out_f: for content in artifact.download_content(): out_f.write(content) From 2d0af8d6556166ac44f6c39ea1a2f807d6725398 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Thu, 13 Feb 2025 16:24:25 +0000 Subject: [PATCH 11/20] Drop requirement for initialized run for creating alerts and move to attach to run --- simvue/run.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/simvue/run.py b/simvue/run.py index e46295d3..38c40398 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -1652,12 +1652,12 @@ def add_alerts( return False + @check_run_initialised def _attach_alert_to_run(self, alert: AlertBase) -> str | None: self._sv_obj.alerts = [alert.id] self._sv_obj.commit() @skip_if_failed("_aborted", "_suppress_errors", None) - @check_run_initialised @pydantic.validate_call def create_metric_range_alert( self, @@ -1734,7 +1734,6 @@ def create_metric_range_alert( return _alert.id @skip_if_failed("_aborted", "_suppress_errors", None) - @check_run_initialised @pydantic.validate_call def create_metric_threshold_alert( self, @@ -1808,7 +1807,6 @@ def create_metric_threshold_alert( return _alert.id @skip_if_failed("_aborted", "_suppress_errors", None) - @check_run_initialised @pydantic.validate_call def create_event_alert( self, @@ -1861,7 +1859,6 @@ def create_event_alert( return _alert.id @skip_if_failed("_aborted", "_suppress_errors", None) - @check_run_initialised @pydantic.validate_call def create_user_alert( self, From 607fb9f0d07969c2a65ba17f7cf922817a1cde9b Mon Sep 17 00:00:00 2001 From: Matt Field Date: Fri, 14 Feb 2025 09:34:20 +0000 Subject: [PATCH 12/20] Removed logger.setLevel from dispatch --- simvue/factory/dispatch/queued.py | 1 - 1 file changed, 1 deletion(-) diff --git a/simvue/factory/dispatch/queued.py b/simvue/factory/dispatch/queued.py index 6ebf5ff3..ae5b094e 100644 --- a/simvue/factory/dispatch/queued.py +++ b/simvue/factory/dispatch/queued.py @@ -21,7 +21,6 @@ QUEUE_SIZE = 10000 logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) class QueuedDispatcher(threading.Thread, DispatcherBaseClass): From 8e30ffc4780425fdc14ade71de2d3843f476a113 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Mon, 17 Feb 2025 14:54:10 +0000 Subject: [PATCH 13/20] Fix alerts setter --- simvue/api/objects/run.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/simvue/api/objects/run.py b/simvue/api/objects/run.py index 3801f26c..f8d75c1e 100644 --- a/simvue/api/objects/run.py +++ b/simvue/api/objects/run.py @@ -245,9 +245,7 @@ def get_alert_details(self) -> typing.Generator[dict[str, typing.Any], None, Non @write_only @pydantic.validate_call def alerts(self, alerts: list[str]) -> None: - self._staging["alerts"] = [ - alert for alert in alerts if alert not in self._staging.get("alerts", []) - ] + self._staging["alerts"] = list(set(self._staging.get("alerts", []) + alerts)) @property @staging_check From cb0221358629ff4edd2c0732756139cc686e74c5 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Tue, 18 Feb 2025 12:15:04 +0000 Subject: [PATCH 14/20] Add randomname generator if run mode is offline --- simvue/run.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simvue/run.py b/simvue/run.py index 954d1743..58fafe97 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -25,7 +25,7 @@ import typing import warnings import uuid - +import randomname import click import psutil @@ -647,6 +647,8 @@ def init( if name and not re.match(r"^[a-zA-Z0-9\-\_\s\/\.:]+$", name): self._error("specified name is invalid") return False + elif not name and self._user_config.run.mode != "online": + name = randomname.get_name() self._name = name From 8912d8ac7c41c8297834fd6ac719c906680008d1 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Tue, 18 Feb 2025 12:15:31 +0000 Subject: [PATCH 15/20] Add randomname generator if run mode is offline --- simvue/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simvue/run.py b/simvue/run.py index 58fafe97..d02709f2 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -647,7 +647,7 @@ def init( if name and not re.match(r"^[a-zA-Z0-9\-\_\s\/\.:]+$", name): self._error("specified name is invalid") return False - elif not name and self._user_config.run.mode != "online": + elif not name and self._user_config.run.mode == "offline": name = randomname.get_name() self._name = name From e916238fb20a2edac1a01b3d27842de7622f7d24 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Tue, 18 Feb 2025 15:05:31 +0000 Subject: [PATCH 16/20] Added created to simvue run --- simvue/api/objects/run.py | 6 ++++++ simvue/run.py | 1 + 2 files changed, 7 insertions(+) diff --git a/simvue/api/objects/run.py b/simvue/api/objects/run.py index f8d75c1e..11328341 100644 --- a/simvue/api/objects/run.py +++ b/simvue/api/objects/run.py @@ -256,6 +256,12 @@ def created(self) -> datetime.datetime | None: datetime.datetime.strptime(_created, DATETIME_FORMAT) if _created else None ) + @created.setter + @write_only + @pydantic.validate_call + def created(self, created: datetime.datetime) -> None: + self._staging["created"] = created.strftime(DATETIME_FORMAT) + @property @staging_check def runtime(self) -> datetime.datetime | None: diff --git a/simvue/run.py b/simvue/run.py index d02709f2..2ee70686 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -689,6 +689,7 @@ def init( self._sv_obj.metadata = (metadata or {}) | git_info(os.getcwd()) | environment() self._sv_obj.heartbeat_timeout = timeout self._sv_obj.alerts = [] + self._sv_obj.created = time.time() if self._status == "running": self._sv_obj.system = get_system() From 7a82c8766b638f83f365b90ce2bd87589024f4a5 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Tue, 18 Feb 2025 15:20:13 +0000 Subject: [PATCH 17/20] Removed api from url printed to screen on run start --- simvue/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simvue/run.py b/simvue/run.py index 2ee70686..9b015ba6 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -718,7 +718,7 @@ def init( fg="green" if self._term_color else None, ) click.secho( - f"[simvue] Monitor in the UI at {self._user_config.server.url}/dashboard/runs/run/{self._id}", + f"[simvue] Monitor in the UI at {self._user_config.server.url.rsplit('/api', 1)[0]}/dashboard/runs/run/{self._id}", bold=self._term_color, fg="green" if self._term_color else None, ) From 8f53b2b71ed5b2e1294bd2cd82955ea797c10c61 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Tue, 18 Feb 2025 16:45:15 +0000 Subject: [PATCH 18/20] Suppressed runtime error in log_event for tracebacks --- simvue/run.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/simvue/run.py b/simvue/run.py index 9b015ba6..484a8299 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -248,19 +248,12 @@ def _handle_exception_throw( else f"An exception was thrown: {_exception_thrown}" ) - self.log_event(_event_msg) - self.set_status("terminated" if _is_terminated else "failed") - # If the dispatcher has already been aborted then this will # fail so just continue without the event with contextlib.suppress(RuntimeError): - self.log_event(f"{_exception_thrown}: {value}") - - if not traceback: - return + self.log_event(_event_msg) - with contextlib.suppress(RuntimeError): - self.log_event(f"Traceback: {traceback}") + self.set_status("terminated" if _is_terminated else "failed") def __exit__( self, From 1a28c7639ce23080c10eaa37dce2d9f20569aa62 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 19 Feb 2025 11:15:00 +0000 Subject: [PATCH 19/20] Parameterized log_metrics tests to include timestamp --- tests/functional/test_run_class.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/functional/test_run_class.py b/tests/functional/test_run_class.py index 84807e54..b447659b 100644 --- a/tests/functional/test_run_class.py +++ b/tests/functional/test_run_class.py @@ -14,7 +14,7 @@ import pathlib import concurrent.futures import random - +import datetime import simvue from simvue.api.objects.alert.fetch import Alert from simvue.exception import SimvueRunError @@ -59,12 +59,14 @@ def test_run_with_emissions() -> None: @pytest.mark.run +@pytest.mark.parametrize("timestamp", (datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f"), None), ids=("timestamp", "no_timestamp")) @pytest.mark.parametrize("overload_buffer", (True, False), ids=("overload", "normal")) @pytest.mark.parametrize( "visibility", ("bad_option", "tenant", "public", ["ciuser01"], None) ) def test_log_metrics( overload_buffer: bool, + timestamp: str | None, setup_logging: "CountingLogHandler", mocker, request: pytest.FixtureRequest, @@ -112,9 +114,9 @@ def test_log_metrics( if overload_buffer: for i in range(run._dispatcher._max_buffer_size * 3): - run.log_metrics({key: i for key in METRICS}) + run.log_metrics({key: i for key in METRICS}, timestamp=timestamp) else: - run.log_metrics(METRICS) + run.log_metrics(METRICS, timestamp=timestamp) time.sleep(2.0 if overload_buffer else 1.0) run.close() client = sv_cl.Client() From 45be82ff36c076268d99215d345fbe47c92bd2c1 Mon Sep 17 00:00:00 2001 From: Matt Field Date: Wed, 19 Feb 2025 15:01:35 +0000 Subject: [PATCH 20/20] Simplify conversion from alert names to ids --- simvue/run.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/simvue/run.py b/simvue/run.py index e9defa0d..c4e92cc2 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -1639,9 +1639,7 @@ def add_alerts( if names and not ids: try: if alerts := Alert.get(offline=self._user_config.run.mode == "offline"): - for alert in alerts: - if alert[1].name in names: - ids.append(alert[1].id) + ids += [id for id, alert in alerts if alert.name in names] else: self._error("No existing alerts") return False