bluer-objects 6.151.1__py3-none-any.whl → 6.155.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.
Potentially problematic release.
This version of bluer-objects might be problematic. Click here for more details.
- bluer_objects/__init__.py +1 -1
- bluer_objects/env.py +1 -0
- bluer_objects/mlflow/logging.py +47 -41
- {bluer_objects-6.151.1.dist-info → bluer_objects-6.155.1.dist-info}/METADATA +2 -2
- {bluer_objects-6.151.1.dist-info → bluer_objects-6.155.1.dist-info}/RECORD +8 -8
- {bluer_objects-6.151.1.dist-info → bluer_objects-6.155.1.dist-info}/WHEEL +0 -0
- {bluer_objects-6.151.1.dist-info → bluer_objects-6.155.1.dist-info}/licenses/LICENSE +0 -0
- {bluer_objects-6.151.1.dist-info → bluer_objects-6.155.1.dist-info}/top_level.txt +0 -0
bluer_objects/__init__.py
CHANGED
bluer_objects/env.py
CHANGED
|
@@ -52,6 +52,7 @@ if MLFLOW_DEPLOYMENT == "local":
|
|
|
52
52
|
else:
|
|
53
53
|
MLFLOW_TRACKING_URI = MLFLOW_DEPLOYMENT
|
|
54
54
|
os.environ["MLFLOW_TRACKING_URI"] = MLFLOW_TRACKING_URI
|
|
55
|
+
MLFLOW_LOG_ARTIFACTS = "arvan" not in MLFLOW_DEPLOYMENT
|
|
55
56
|
|
|
56
57
|
WEBDAV_HOSTNAME = get_env("WEBDAV_HOSTNAME")
|
|
57
58
|
WEBDAV_LOGIN = get_env("WEBDAV_LOGIN")
|
bluer_objects/mlflow/logging.py
CHANGED
|
@@ -6,7 +6,7 @@ import mlflow
|
|
|
6
6
|
from blueness import module
|
|
7
7
|
from bluer_options.logger import crash_report
|
|
8
8
|
|
|
9
|
-
from bluer_objects import file, objects, NAME
|
|
9
|
+
from bluer_objects import file, objects, NAME, env
|
|
10
10
|
from bluer_objects.mlflow.runs import start_run, end_run
|
|
11
11
|
from bluer_objects.logger import logger
|
|
12
12
|
|
|
@@ -22,25 +22,28 @@ def log_artifacts(
|
|
|
22
22
|
|
|
23
23
|
object_path = objects.object_path(object_name, create=True)
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if env.MLFLOW_LOG_ARTIFACTS:
|
|
26
|
+
try:
|
|
27
|
+
mlflow.log_artifacts(object_path)
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
logger.info("⬆️ {}".format(object_name))
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
# https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.register_model
|
|
32
|
+
# https://stackoverflow.com/a/71447758/17619982
|
|
33
|
+
if model_name:
|
|
34
|
+
mv = mlflow.register_model(
|
|
35
|
+
"runs:/{}".format(mlflow.active_run().info.run_id),
|
|
36
|
+
model_name,
|
|
37
|
+
await_registration_for=0,
|
|
38
|
+
)
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
logger.info("*️⃣ {} -> {}.{}".format(object_name, mv.name, mv.version))
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
except:
|
|
43
|
+
crash_report(f"{NAME}.log_artifacts({object_name})")
|
|
44
|
+
return False
|
|
45
|
+
else:
|
|
46
|
+
logger.info("skipped log artifacts.")
|
|
44
47
|
|
|
45
48
|
return end_run(object_name)
|
|
46
49
|
|
|
@@ -51,31 +54,34 @@ def log_run(object_name: str) -> bool:
|
|
|
51
54
|
|
|
52
55
|
object_path = objects.object_path(object_name, create=True)
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
for
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
filename_name = file.name(filename)
|
|
61
|
-
|
|
62
|
-
counts[len(filename_name)] = counts.get(len(filename_name), 0) + 1
|
|
63
|
-
|
|
64
|
-
if any(
|
|
65
|
-
[
|
|
66
|
-
file.size(filename) > 10 * 1024 * 1024,
|
|
67
|
-
filename_name.startswith("thumbnail"),
|
|
68
|
-
counts[len(filename_name)] > 20,
|
|
69
|
-
]
|
|
57
|
+
if env.MLFLOW_LOG_ARTIFACTS:
|
|
58
|
+
counts: Dict[str, int] = {}
|
|
59
|
+
skipped_count = 0
|
|
60
|
+
for extension in "dot,gif,jpeg,jpg,json,png,sh,xml,yaml".split(","):
|
|
61
|
+
for filename in glob.glob(
|
|
62
|
+
os.path.join(object_path, f"*.{extension}"),
|
|
70
63
|
):
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
filename_name = file.name(filename)
|
|
65
|
+
|
|
66
|
+
counts[len(filename_name)] = counts.get(len(filename_name), 0) + 1
|
|
67
|
+
|
|
68
|
+
if any(
|
|
69
|
+
[
|
|
70
|
+
file.size(filename) > 10 * 1024 * 1024,
|
|
71
|
+
filename_name.startswith("thumbnail"),
|
|
72
|
+
counts[len(filename_name)] > 20,
|
|
73
|
+
]
|
|
74
|
+
):
|
|
75
|
+
logger.info(f"skipping {filename}")
|
|
76
|
+
skipped_count += 1
|
|
77
|
+
continue
|
|
78
|
+
|
|
79
|
+
mlflow.log_artifact(filename)
|
|
80
|
+
logger.info(f"⬆️ {filename}")
|
|
81
|
+
|
|
82
|
+
if skipped_count:
|
|
83
|
+
logger.info(f"skipped {skipped_count:,} file(s).")
|
|
84
|
+
else:
|
|
85
|
+
logger.info("skipped log artifacts.")
|
|
80
86
|
|
|
81
87
|
return end_run(object_name)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bluer_objects
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.155.1
|
|
4
4
|
Summary: 🌀 Object management in Bash.
|
|
5
5
|
Home-page: https://github.com/kamangir/bluer-objects
|
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
|
@@ -64,6 +64,6 @@ pip install bluer-objects
|
|
|
64
64
|
|
|
65
65
|
[](https://github.com/kamangir/bluer-objects/actions/workflows/pylint.yml) [](https://github.com/kamangir/bluer-objects/actions/workflows/pytest.yml) [](https://github.com/kamangir/bluer-objects/actions/workflows/bashtest.yml) [](https://pypi.org/project/bluer-objects/) [](https://pypistats.org/packages/bluer-objects)
|
|
66
66
|
|
|
67
|
-
built by 🌀 [`bluer README`](https://github.com/kamangir/bluer-objects/tree/main/bluer_objects/README), based on 🌀 [`bluer_objects-6.
|
|
67
|
+
built by 🌀 [`bluer README`](https://github.com/kamangir/bluer-objects/tree/main/bluer_objects/README), based on 🌀 [`bluer_objects-6.155.1`](https://github.com/kamangir/bluer-objects).
|
|
68
68
|
|
|
69
69
|
built by 🌀 [`blueness-3.118.1`](https://github.com/kamangir/blueness).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
bluer_objects/__init__.py,sha256=
|
|
1
|
+
bluer_objects/__init__.py,sha256=SI2bYRTAof62w9VKNRAYmPllTvuhoSuD6p4KuzBTd34,315
|
|
2
2
|
bluer_objects/__main__.py,sha256=Yqfov833_hJuRne19WrGhT5DWAPtdffpoMxeSXS7EGw,359
|
|
3
3
|
bluer_objects/config.env,sha256=95lXp0kUrsGoUetHgxJpQ4QD16TdFyf-u1AiKBhtrlQ,106
|
|
4
|
-
bluer_objects/env.py,sha256=
|
|
4
|
+
bluer_objects/env.py,sha256=ZVA8hZfpyuZ493lVkN9vFbUjVlrkrrH6wjC_DcZg52k,1795
|
|
5
5
|
bluer_objects/markdown.py,sha256=PhAwCTHIisO9qOpKHeb63U5oD9Zi8LnIQKTx_OWS4wE,938
|
|
6
6
|
bluer_objects/objects.py,sha256=EYzA1vKngY2c_gdMKnUfrKVUcf-5wpFKgBFaVJA4cLE,1626
|
|
7
7
|
bluer_objects/path.py,sha256=9uspZqObI29NerVDF30uILLaouDtloASh0Mywyq2_ew,3946
|
|
@@ -104,7 +104,7 @@ bluer_objects/metadata/post.py,sha256=1r0yLmIuEPrKJ_-RfALC5ajpLzmUqEjLYoIQMuI4Jj
|
|
|
104
104
|
bluer_objects/mlflow/__init__.py,sha256=GVPXTclqYAyu-iJoLeHSgTaMeoMpVaczFgU4PavS3QA,523
|
|
105
105
|
bluer_objects/mlflow/__main__.py,sha256=uPRUT0x__m1jJ-TTRHmzSdv3AEFM2oKGqOJOG6wdSMk,5819
|
|
106
106
|
bluer_objects/mlflow/cache.py,sha256=RQu9hLI6oRhCvj0N1VLcynSutjsxU4wQDo7N3m3i3ho,310
|
|
107
|
-
bluer_objects/mlflow/logging.py,sha256=
|
|
107
|
+
bluer_objects/mlflow/logging.py,sha256=tyECJl56SY7IsLAuMUsmXoAuyGFLcwKqrbrj5y_IvYE,2612
|
|
108
108
|
bluer_objects/mlflow/models.py,sha256=6xU64Irq9LWyWFwzDJoqMN8KGziSv9VbOGv1tALzf9M,1280
|
|
109
109
|
bluer_objects/mlflow/objects.py,sha256=aXYHLRCTt1FtDQoyPOG-doCFms7qF6Krz00Fg3kzJSM,1844
|
|
110
110
|
bluer_objects/mlflow/runs.py,sha256=v1IKRvxbuKkengESnG-xdUXxxNSkALMeBmfMQwrUKSs,2416
|
|
@@ -147,8 +147,8 @@ bluer_objects/tests/test_storage_webdav_request.py,sha256=h2b8PeIx0-hQ2d6PmQcJZy
|
|
|
147
147
|
bluer_objects/tests/test_storage_webdav_zip.py,sha256=C19qxhkcHyTwVFzW35vL85SOcXJPkqXXaWUNll0Uyqc,1017
|
|
148
148
|
bluer_objects/tests/test_testing.py,sha256=d2NH435yqJBl9wmfMqGGd-f0Y0jsL2QhHUXkty9AwPA,235
|
|
149
149
|
bluer_objects/tests/test_version.py,sha256=Lyf3PMcA22e17BNRk_2VgPrtao6dWEgVoXo68Uds8SE,75
|
|
150
|
-
bluer_objects-6.
|
|
151
|
-
bluer_objects-6.
|
|
152
|
-
bluer_objects-6.
|
|
153
|
-
bluer_objects-6.
|
|
154
|
-
bluer_objects-6.
|
|
150
|
+
bluer_objects-6.155.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
|
|
151
|
+
bluer_objects-6.155.1.dist-info/METADATA,sha256=ABeLks5OcoMNh-1udT5ZXQx0EGkm5dr9VvGQLQnrvh4,3575
|
|
152
|
+
bluer_objects-6.155.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
153
|
+
bluer_objects-6.155.1.dist-info/top_level.txt,sha256=RX2TpddbnRkurda3G_pAdyeTztP2IhhRPx949GlEvQo,14
|
|
154
|
+
bluer_objects-6.155.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|