bluer-objects 6.377.1__py3-none-any.whl → 6.464.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.
- bluer_objects/.abcli/alias.sh +8 -12
- bluer_objects/.abcli/assets/cd.sh +1 -1
- bluer_objects/.abcli/assets/mv.sh +6 -6
- bluer_objects/.abcli/assets/publish.sh +4 -1
- bluer_objects/.abcli/mlflow/tags/search.sh +1 -5
- bluer_objects/.abcli/tests/help.sh +0 -7
- bluer_objects/.abcli/tests/mlflow_tags.sh +1 -1
- bluer_objects/.abcli/tests/pdf.sh +10 -2
- bluer_objects/README/__init__.py +7 -37
- bluer_objects/README/alias.py +15 -4
- bluer_objects/README/build/__init__.py +0 -0
- bluer_objects/README/build/aliases.py +23 -0
- bluer_objects/README/build/docs.py +23 -0
- bluer_objects/README/build/modules.py +9 -0
- bluer_objects/README/consts.py +8 -3
- bluer_objects/README/functions.py +50 -22
- bluer_objects/README/process/__init__.py +0 -0
- bluer_objects/README/process/assets.py +36 -0
- bluer_objects/README/process/details.py +20 -0
- bluer_objects/README/process/envs.py +23 -0
- bluer_objects/README/process/help.py +27 -0
- bluer_objects/README/process/include.py +40 -0
- bluer_objects/README/process/legacy.py +21 -0
- bluer_objects/README/process/mermaid.py +20 -0
- bluer_objects/README/process/national_internet.py +55 -0
- bluer_objects/README/process/objects.py +32 -0
- bluer_objects/README/process/signature.py +35 -0
- bluer_objects/README/process/title.py +44 -0
- bluer_objects/README/process/variables.py +12 -0
- bluer_objects/__init__.py +1 -1
- bluer_objects/config.env +8 -4
- bluer_objects/env.py +4 -1
- bluer_objects/file/functions.py +8 -1
- bluer_objects/help/assets.py +6 -9
- bluer_objects/help/functions.py +0 -2
- bluer_objects/help/mlflow/cache.py +2 -4
- bluer_objects/help/mlflow/tags.py +34 -23
- bluer_objects/mlflow/__init__.py +1 -1
- bluer_objects/mlflow/__main__.py +49 -31
- bluer_objects/mlflow/lock/functions.py +1 -1
- bluer_objects/mlflow/logging.py +6 -0
- bluer_objects/mlflow/models.py +7 -0
- bluer_objects/mlflow/objects.py +7 -0
- bluer_objects/mlflow/runs.py +10 -1
- bluer_objects/mlflow/serverless/__init__.py +3 -0
- bluer_objects/mlflow/serverless/api.py +88 -0
- bluer_objects/mlflow/serverless/read.py +19 -0
- bluer_objects/mlflow/serverless/search.py +35 -0
- bluer_objects/mlflow/serverless/write.py +42 -0
- bluer_objects/mlflow/tags.py +59 -9
- bluer_objects/objects.py +3 -1
- bluer_objects/pdf/convert/convert.py +1 -2
- bluer_objects/tests/test_env.py +34 -22
- bluer_objects/tests/test_file_download.py +5 -0
- bluer_objects/tests/test_mlflow.py +112 -3
- bluer_objects/tests/test_web_is_accessible.py +1 -1
- {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/METADATA +19 -13
- {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/RECORD +61 -50
- {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/WHEEL +1 -1
- bluer_objects/.abcli/tests/mlflow_test.sh +0 -7
- bluer_objects/.abcli/tests/web_is_accessible.sh +0 -17
- bluer_objects/.abcli/tests/web_where_am_ai.sh +0 -5
- bluer_objects/.abcli/url.sh +0 -15
- bluer_objects/.abcli/web/is_accessible.sh +0 -13
- bluer_objects/.abcli/web/where_am_i.sh +0 -5
- bluer_objects/README/utils.py +0 -275
- bluer_objects/help/web.py +0 -38
- bluer_objects/web/__init__.py +0 -1
- bluer_objects/web/__main__.py +0 -31
- bluer_objects/web/functions.py +0 -9
- {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/licenses/LICENSE +0 -0
- {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from bluer_objects.logger import logger
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def process_mermaid(template_line: str) -> List[str]:
|
|
7
|
+
template_line_pieces = template_line.split('"')
|
|
8
|
+
if len(template_line_pieces) != 3:
|
|
9
|
+
logger.error(f"🧜🏽♀️ mermaid line not in expected format: {template_line}.")
|
|
10
|
+
return False
|
|
11
|
+
|
|
12
|
+
template_line_pieces[1] = (
|
|
13
|
+
template_line_pieces[1]
|
|
14
|
+
.replace("<", "<")
|
|
15
|
+
.replace(">", ">")
|
|
16
|
+
.replace(" ", "<br>")
|
|
17
|
+
.replace("~~", " ")
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
return ['"'.join(template_line_pieces)]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from bluer_options import env
|
|
4
|
+
from bluer_options.help.parsing import list_of_modules
|
|
5
|
+
|
|
6
|
+
from bluer_objects import file
|
|
7
|
+
from bluer_objects import path
|
|
8
|
+
from bluer_objects.env import abcli_path_git
|
|
9
|
+
from bluer_objects.README.consts import github_kamangir
|
|
10
|
+
from bluer_objects.logger import logger
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def process_national_internet(
|
|
14
|
+
filename: str,
|
|
15
|
+
content: List[str],
|
|
16
|
+
) -> List[str]:
|
|
17
|
+
if env.BLUER_AI_WEB_STATUS == "online":
|
|
18
|
+
return content
|
|
19
|
+
|
|
20
|
+
logger.info("🇮🇷 national internet adjustments...")
|
|
21
|
+
|
|
22
|
+
for this, that in {
|
|
23
|
+
"{}/{}/{}/main".format(
|
|
24
|
+
github_kamangir,
|
|
25
|
+
repo_name,
|
|
26
|
+
where,
|
|
27
|
+
): "{}/{}".format(
|
|
28
|
+
abcli_path_git,
|
|
29
|
+
repo_name,
|
|
30
|
+
)
|
|
31
|
+
for repo_name in (
|
|
32
|
+
[
|
|
33
|
+
"assets",
|
|
34
|
+
"assets2",
|
|
35
|
+
]
|
|
36
|
+
+ [module.replace("_", "-") for module in list_of_modules]
|
|
37
|
+
)
|
|
38
|
+
for where in [
|
|
39
|
+
"blob",
|
|
40
|
+
"raw",
|
|
41
|
+
"tree",
|
|
42
|
+
]
|
|
43
|
+
}.items():
|
|
44
|
+
content = [
|
|
45
|
+
line.replace(
|
|
46
|
+
this,
|
|
47
|
+
path.relative(
|
|
48
|
+
that,
|
|
49
|
+
file.path(filename),
|
|
50
|
+
),
|
|
51
|
+
)
|
|
52
|
+
for line in content
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
return content
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from bluer_objects import env
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def process_objects(template_line: str) -> str:
|
|
5
|
+
def suffix(token: str):
|
|
6
|
+
words = token.split(":::")
|
|
7
|
+
object_name = token.split(":::")[1].strip()
|
|
8
|
+
|
|
9
|
+
if len(words) <= 2:
|
|
10
|
+
return f"{object_name}.tar.gz"
|
|
11
|
+
|
|
12
|
+
filename = words[2].strip()
|
|
13
|
+
return f"{object_name}/{filename}"
|
|
14
|
+
|
|
15
|
+
if "object:::" in template_line:
|
|
16
|
+
template_line = " ".join(
|
|
17
|
+
[
|
|
18
|
+
(
|
|
19
|
+
"[{}](https://{}.{}/{})".format(
|
|
20
|
+
suffix(token),
|
|
21
|
+
env.S3_PUBLIC_STORAGE_BUCKET,
|
|
22
|
+
env.S3_STORAGE_ENDPOINT_URL.split("https://", 1)[1],
|
|
23
|
+
suffix(token),
|
|
24
|
+
)
|
|
25
|
+
if token.startswith("object:::")
|
|
26
|
+
else token
|
|
27
|
+
)
|
|
28
|
+
for token in template_line.split(" ")
|
|
29
|
+
]
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return template_line
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from bluer_objects import ICON as MY_ICON
|
|
4
|
+
from bluer_objects.logger import logger
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def signature(
|
|
8
|
+
REPO_NAME: str,
|
|
9
|
+
NAME: str,
|
|
10
|
+
ICON: str,
|
|
11
|
+
MODULE_NAME: str,
|
|
12
|
+
VERSION: str,
|
|
13
|
+
) -> List[str]:
|
|
14
|
+
return [
|
|
15
|
+
"",
|
|
16
|
+
" ".join(
|
|
17
|
+
[
|
|
18
|
+
f"[](https://github.com/kamangir/{REPO_NAME}/actions/workflows/pylint.yml)",
|
|
19
|
+
f"[](https://github.com/kamangir/{REPO_NAME}/actions/workflows/pytest.yml)",
|
|
20
|
+
f"[](https://github.com/kamangir/{REPO_NAME}/actions/workflows/bashtest.yml)",
|
|
21
|
+
f"[](https://pypi.org/project/{MODULE_NAME}/)",
|
|
22
|
+
f"[](https://pypistats.org/packages/{MODULE_NAME})",
|
|
23
|
+
]
|
|
24
|
+
),
|
|
25
|
+
"",
|
|
26
|
+
"built by {} [`{}`]({}), based on {}[`{}-{}`]({}).".format(
|
|
27
|
+
MY_ICON,
|
|
28
|
+
"bluer README",
|
|
29
|
+
"https://github.com/kamangir/bluer-objects/tree/main/bluer_objects/README",
|
|
30
|
+
f"{ICON} " if ICON else "",
|
|
31
|
+
NAME,
|
|
32
|
+
VERSION,
|
|
33
|
+
f"https://github.com/kamangir/{REPO_NAME}",
|
|
34
|
+
),
|
|
35
|
+
]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import List, Tuple
|
|
3
|
+
|
|
4
|
+
from bluer_objects import file
|
|
5
|
+
from bluer_objects.logger import logger
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def process_title(
|
|
9
|
+
template_line: str,
|
|
10
|
+
filename: str,
|
|
11
|
+
) -> Tuple[bool, List[str]]:
|
|
12
|
+
template_line_pieces = [
|
|
13
|
+
piece for piece in template_line.strip().split(":::") if piece
|
|
14
|
+
]
|
|
15
|
+
reference = template_line_pieces[1] if len(template_line_pieces) >= 2 else "docs"
|
|
16
|
+
|
|
17
|
+
filename_path_pieces = file.path(filename).split(os.sep)
|
|
18
|
+
if reference not in filename_path_pieces:
|
|
19
|
+
logger.error(
|
|
20
|
+
"reference: {} not found in {}.".format(
|
|
21
|
+
reference,
|
|
22
|
+
template_line,
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
return False, []
|
|
26
|
+
|
|
27
|
+
title_pieces = filename_path_pieces[filename_path_pieces.index(reference) + 1 :]
|
|
28
|
+
filename_name = file.name(filename)
|
|
29
|
+
if filename_name != "README":
|
|
30
|
+
title_pieces.append(filename_name)
|
|
31
|
+
|
|
32
|
+
return True, [
|
|
33
|
+
"# {}".format(
|
|
34
|
+
": ".join(
|
|
35
|
+
[
|
|
36
|
+
piece.replace(
|
|
37
|
+
"_",
|
|
38
|
+
"-",
|
|
39
|
+
)
|
|
40
|
+
for piece in title_pieces
|
|
41
|
+
]
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import Dict
|
|
2
|
+
|
|
3
|
+
from bluer_objects.logger import logger
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
variables: Dict[str, str] = {}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def process_variable(template_line: str):
|
|
10
|
+
key, value = template_line.split("set:::", 1)[1].split(" ", 1)
|
|
11
|
+
variables[key] = value
|
|
12
|
+
logger.info(f"{key} = {value}")
|
bluer_objects/__init__.py
CHANGED
bluer_objects/config.env
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
ABCLI_MLFLOW_EXPERIMENT_PREFIX=experiment/
|
|
2
2
|
|
|
3
|
+
BLUER_OBJECTS_STORAGE_INTERFACE=s3
|
|
4
|
+
|
|
5
|
+
BLUER_OBJECTS_TEST_OBJECT=2025-09-22-13-11-08-cjbb3q
|
|
6
|
+
|
|
7
|
+
MLFLOW_IS_SERVERLESS=1
|
|
8
|
+
|
|
3
9
|
MLFLOW_LOCK_WAIT_FOR_CLEARANCE=3
|
|
4
10
|
MLFLOW_LOCK_WAIT_FOR_EXCLUSIVITY=1
|
|
5
11
|
|
|
6
|
-
S3_STORAGE_BUCKET=kamangir
|
|
7
12
|
S3_PUBLIC_STORAGE_BUCKET=kamangir-public
|
|
13
|
+
S3_STORAGE_BUCKET=kamangir
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
BLUER_OBJECTS_TEST_OBJECT=2025-09-22-13-11-08-cjbb3q
|
|
15
|
+
BLUER_OBJECTS_DEFAULT_ASSETS_VOL=2
|
bluer_objects/env.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from typing import Union
|
|
2
1
|
import os
|
|
3
2
|
|
|
4
3
|
from bluer_options.env import load_config, load_env, get_env
|
|
@@ -63,3 +62,7 @@ WEBDAV_LOGIN = get_env("WEBDAV_LOGIN")
|
|
|
63
62
|
WEBDAV_PASSWORD = get_env("WEBDAV_PASSWORD")
|
|
64
63
|
|
|
65
64
|
BLUER_OBJECTS_TEST_OBJECT = get_env("BLUER_OBJECTS_TEST_OBJECT")
|
|
65
|
+
|
|
66
|
+
MLFLOW_IS_SERVERLESS = get_env("MLFLOW_IS_SERVERLESS", 1)
|
|
67
|
+
|
|
68
|
+
BLUER_OBJECTS_DEFAULT_ASSETS_VOL = get_env("BLUER_OBJECTS_DEFAULT_ASSETS_VOL")
|
bluer_objects/file/functions.py
CHANGED
|
@@ -169,7 +169,14 @@ def download(
|
|
|
169
169
|
return False
|
|
170
170
|
|
|
171
171
|
if log:
|
|
172
|
-
logger.info(
|
|
172
|
+
logger.info(
|
|
173
|
+
"{}: {} -{}-> {}".format(
|
|
174
|
+
NAME,
|
|
175
|
+
url,
|
|
176
|
+
string.pretty_bytes(size(filename)),
|
|
177
|
+
filename,
|
|
178
|
+
)
|
|
179
|
+
)
|
|
173
180
|
|
|
174
181
|
return True
|
|
175
182
|
|
bluer_objects/help/assets.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
|
|
3
|
-
from bluer_options.terminal import show_usage, xtra
|
|
4
3
|
from bluer_ai.help.git import push_options
|
|
4
|
+
from bluer_options.terminal import show_usage, xtra
|
|
5
|
+
|
|
6
|
+
from bluer_objects import env
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
def help_cd(
|
|
@@ -11,7 +13,7 @@ def help_cd(
|
|
|
11
13
|
options = "".join(
|
|
12
14
|
[
|
|
13
15
|
xtra("create,", mono=mono),
|
|
14
|
-
"vol=<
|
|
16
|
+
"vol=<{}>".format(env.BLUER_OBJECTS_DEFAULT_ASSETS_VOL),
|
|
15
17
|
]
|
|
16
18
|
)
|
|
17
19
|
|
|
@@ -31,19 +33,14 @@ def help_mv(
|
|
|
31
33
|
tokens: List[str],
|
|
32
34
|
mono: bool,
|
|
33
35
|
) -> str:
|
|
34
|
-
options = ""
|
|
35
|
-
[
|
|
36
|
-
xtra("create,", mono=mono),
|
|
37
|
-
"extension=<png>,vol=<2>",
|
|
38
|
-
]
|
|
39
|
-
)
|
|
36
|
+
options = xtra("~create,extension=<jpg>,vol=<2>", mono=mono)
|
|
40
37
|
|
|
41
38
|
return show_usage(
|
|
42
39
|
[
|
|
43
40
|
"@assets",
|
|
44
41
|
"mv",
|
|
45
42
|
f"[{options}]",
|
|
46
|
-
"[<
|
|
43
|
+
"[<this/that>]",
|
|
47
44
|
"[push,{}]".format(
|
|
48
45
|
push_options(
|
|
49
46
|
mono=mono,
|
bluer_objects/help/functions.py
CHANGED
|
@@ -13,7 +13,6 @@ from bluer_objects.help.metadata import help_functions as help_metadata
|
|
|
13
13
|
from bluer_objects.help.mlflow import help_functions as help_mlflow
|
|
14
14
|
from bluer_objects.help.pdf import help_functions as help_pdf
|
|
15
15
|
from bluer_objects.help.upload import help_upload
|
|
16
|
-
from bluer_objects.help.web import help_functions as help_web
|
|
17
16
|
|
|
18
17
|
help_functions = generic_help_functions(plugin_name=ALIAS)
|
|
19
18
|
|
|
@@ -31,6 +30,5 @@ help_functions.update(
|
|
|
31
30
|
"mlflow": help_mlflow,
|
|
32
31
|
"pdf": help_pdf,
|
|
33
32
|
"upload": help_upload,
|
|
34
|
-
"web": help_web,
|
|
35
33
|
}
|
|
36
34
|
)
|
|
@@ -9,8 +9,7 @@ def help_read(
|
|
|
9
9
|
) -> str:
|
|
10
10
|
return show_usage(
|
|
11
11
|
[
|
|
12
|
-
"@
|
|
13
|
-
"cache",
|
|
12
|
+
"@cache",
|
|
14
13
|
"read",
|
|
15
14
|
"<keyword>",
|
|
16
15
|
],
|
|
@@ -25,8 +24,7 @@ def help_write(
|
|
|
25
24
|
) -> str:
|
|
26
25
|
return show_usage(
|
|
27
26
|
[
|
|
28
|
-
"@
|
|
29
|
-
"cache",
|
|
27
|
+
"@cache",
|
|
30
28
|
"write",
|
|
31
29
|
"<keyword>",
|
|
32
30
|
"<value>",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
|
|
3
|
-
from bluer_options.terminal import show_usage
|
|
3
|
+
from bluer_options.terminal import show_usage
|
|
4
|
+
|
|
5
|
+
from bluer_objects import env
|
|
4
6
|
|
|
5
7
|
search_args = [
|
|
6
8
|
"[--count <-1>]",
|
|
@@ -16,8 +18,7 @@ def help_clone(
|
|
|
16
18
|
) -> str:
|
|
17
19
|
return show_usage(
|
|
18
20
|
[
|
|
19
|
-
"@
|
|
20
|
-
"tags",
|
|
21
|
+
"@tags",
|
|
21
22
|
"clone",
|
|
22
23
|
"[..|<object-1>]",
|
|
23
24
|
"[.|<object-2>]",
|
|
@@ -35,8 +36,7 @@ def help_get(
|
|
|
35
36
|
|
|
36
37
|
return show_usage(
|
|
37
38
|
[
|
|
38
|
-
"@
|
|
39
|
-
"tags",
|
|
39
|
+
"@tags",
|
|
40
40
|
"get",
|
|
41
41
|
"[.|<object-name>]",
|
|
42
42
|
]
|
|
@@ -50,40 +50,47 @@ def help_search(
|
|
|
50
50
|
tokens: List[str],
|
|
51
51
|
mono: bool,
|
|
52
52
|
) -> str:
|
|
53
|
-
options = "
|
|
53
|
+
options = "<keyword-1>=<value-1>,<keyword-2>,~<keyword-3>"
|
|
54
54
|
|
|
55
55
|
usage_1 = show_usage(
|
|
56
56
|
[
|
|
57
|
-
"@
|
|
58
|
-
"tags",
|
|
57
|
+
"@tags",
|
|
59
58
|
"search",
|
|
60
59
|
f"[{options}]",
|
|
61
60
|
]
|
|
62
|
-
+ search_args
|
|
63
|
-
|
|
64
|
-
"search mlflow for <filter-string>",
|
|
65
|
-
{
|
|
66
|
-
"<finter-string>: https://www.mlflow.org/docs/latest/search-experiments.html": ""
|
|
67
|
-
},
|
|
61
|
+
+ search_args,
|
|
62
|
+
"search mlflow.",
|
|
68
63
|
mono=mono,
|
|
69
64
|
)
|
|
70
65
|
|
|
66
|
+
if env.MLFLOW_IS_SERVERLESS:
|
|
67
|
+
return usage_1
|
|
68
|
+
|
|
71
69
|
# ---
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
args = sorted(
|
|
72
|
+
[
|
|
73
|
+
"[--server_style 1]",
|
|
74
|
+
"[--filter_string <filter-string>]",
|
|
75
|
+
]
|
|
76
|
+
+ search_args
|
|
77
|
+
)
|
|
74
78
|
|
|
75
79
|
usage_2 = show_usage(
|
|
76
80
|
[
|
|
77
|
-
"@
|
|
78
|
-
"tags",
|
|
81
|
+
"@tags",
|
|
79
82
|
"search",
|
|
80
|
-
f"[{options}]",
|
|
81
83
|
]
|
|
82
|
-
+
|
|
83
|
-
"search mlflow
|
|
84
|
+
+ args,
|
|
85
|
+
"search mlflow server for <filter-string>.",
|
|
86
|
+
{
|
|
87
|
+
"<filter-string>: https://www.mlflow.org/docs/latest/search-experiments.html": ""
|
|
88
|
+
},
|
|
84
89
|
mono=mono,
|
|
85
90
|
)
|
|
86
91
|
|
|
92
|
+
# ---
|
|
93
|
+
|
|
87
94
|
return "\n".join(
|
|
88
95
|
[
|
|
89
96
|
usage_1,
|
|
@@ -98,14 +105,18 @@ def help_set(
|
|
|
98
105
|
) -> str:
|
|
99
106
|
options = "<keyword-1>=<value>,<keyword-2>,~<keyword-3>"
|
|
100
107
|
|
|
108
|
+
args = [
|
|
109
|
+
"[--verbose 1]",
|
|
110
|
+
]
|
|
111
|
+
|
|
101
112
|
return show_usage(
|
|
102
113
|
[
|
|
103
|
-
"@
|
|
104
|
-
"tags",
|
|
114
|
+
"@tags",
|
|
105
115
|
"set",
|
|
106
116
|
"[.|<object-name>]",
|
|
107
117
|
f"[{options}]",
|
|
108
|
-
]
|
|
118
|
+
]
|
|
119
|
+
+ args,
|
|
109
120
|
"set tags in mlflow.",
|
|
110
121
|
mono=mono,
|
|
111
122
|
)
|
bluer_objects/mlflow/__init__.py
CHANGED
bluer_objects/mlflow/__main__.py
CHANGED
|
@@ -24,7 +24,6 @@ from bluer_objects.mlflow.runs import (
|
|
|
24
24
|
start_run,
|
|
25
25
|
)
|
|
26
26
|
from bluer_objects.mlflow.tags import (
|
|
27
|
-
create_filter_string,
|
|
28
27
|
get_tags,
|
|
29
28
|
search,
|
|
30
29
|
set_tags,
|
|
@@ -42,7 +41,23 @@ parser.add_argument(
|
|
|
42
41
|
"task",
|
|
43
42
|
type=str,
|
|
44
43
|
default="",
|
|
45
|
-
help="
|
|
44
|
+
help=" | ".join(
|
|
45
|
+
[
|
|
46
|
+
"clone_tags",
|
|
47
|
+
"get_id",
|
|
48
|
+
"get_run_id",
|
|
49
|
+
"get_tags",
|
|
50
|
+
"list_registered_models",
|
|
51
|
+
"log_artifacts",
|
|
52
|
+
"log_run",
|
|
53
|
+
"rm",
|
|
54
|
+
"search",
|
|
55
|
+
"set_tags",
|
|
56
|
+
"start_end_run",
|
|
57
|
+
"test",
|
|
58
|
+
"transition",
|
|
59
|
+
]
|
|
60
|
+
),
|
|
46
61
|
)
|
|
47
62
|
parser.add_argument(
|
|
48
63
|
"--count",
|
|
@@ -115,13 +130,13 @@ parser.add_argument(
|
|
|
115
130
|
"--log",
|
|
116
131
|
type=int,
|
|
117
132
|
default=1,
|
|
118
|
-
help="0|1",
|
|
133
|
+
help="0 | 1",
|
|
119
134
|
)
|
|
120
135
|
parser.add_argument(
|
|
121
|
-
"--
|
|
136
|
+
"--server_style",
|
|
122
137
|
type=int,
|
|
123
138
|
default=0,
|
|
124
|
-
help="0|1",
|
|
139
|
+
help="0 | 1",
|
|
125
140
|
)
|
|
126
141
|
parser.add_argument(
|
|
127
142
|
"--start_end",
|
|
@@ -162,6 +177,12 @@ parser.add_argument(
|
|
|
162
177
|
default="",
|
|
163
178
|
help="",
|
|
164
179
|
)
|
|
180
|
+
parser.add_argument(
|
|
181
|
+
"--verbose",
|
|
182
|
+
type=int,
|
|
183
|
+
default=0,
|
|
184
|
+
help="0 | 1",
|
|
185
|
+
)
|
|
165
186
|
args = parser.parse_args()
|
|
166
187
|
|
|
167
188
|
delim = " " if args.delim == "space" else args.delim
|
|
@@ -171,9 +192,6 @@ if args.task == "clone_tags":
|
|
|
171
192
|
success, tags = get_tags(args.source_objects)
|
|
172
193
|
if success:
|
|
173
194
|
success = set_tags(args.destination_object, tags)
|
|
174
|
-
elif args.task == "create_filter_string":
|
|
175
|
-
success = True
|
|
176
|
-
print(create_filter_string(args.tags))
|
|
177
195
|
elif args.task == "rm":
|
|
178
196
|
success = reduce(
|
|
179
197
|
lambda x, y: x and y,
|
|
@@ -188,7 +206,10 @@ elif args.task == "rm":
|
|
|
188
206
|
True,
|
|
189
207
|
)
|
|
190
208
|
elif args.task == "get_tags":
|
|
191
|
-
success, tags = get_tags(
|
|
209
|
+
success, tags = get_tags(
|
|
210
|
+
args.object_name,
|
|
211
|
+
verbose=args.verbose == 1,
|
|
212
|
+
)
|
|
192
213
|
print(tags if not args.tag else tags.get(args.tag, args.default))
|
|
193
214
|
elif args.task == "get_id":
|
|
194
215
|
success, id = get_id(args.object_name)
|
|
@@ -217,36 +238,33 @@ elif args.task == "log_artifacts":
|
|
|
217
238
|
elif args.task == "log_run":
|
|
218
239
|
success = log_run(args.object_name)
|
|
219
240
|
elif args.task == "search":
|
|
220
|
-
success =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
create_filter_string(args.tags)
|
|
224
|
-
if args.explicit_query == 0
|
|
225
|
-
else "" if args.filter_string == "-" else args.filter_string
|
|
241
|
+
success, list_of_objects = search(
|
|
242
|
+
filter_string=args.tags,
|
|
243
|
+
server_style=args.server_style == 1,
|
|
226
244
|
)
|
|
227
245
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
list_of_objects = list_of_objects[args.offset :]
|
|
246
|
+
if success:
|
|
247
|
+
list_of_objects = list_of_objects[args.offset :]
|
|
231
248
|
|
|
232
|
-
|
|
233
|
-
|
|
249
|
+
if args.count != -1:
|
|
250
|
+
list_of_objects = list_of_objects[: args.count]
|
|
234
251
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
252
|
+
if args.log:
|
|
253
|
+
logger.info(
|
|
254
|
+
"{:,} {}.".format(
|
|
255
|
+
len(list_of_objects),
|
|
256
|
+
args.item_name_plural,
|
|
257
|
+
),
|
|
258
|
+
)
|
|
259
|
+
for index, object_name in enumerate(list_of_objects):
|
|
260
|
+
logger.info(f"#{index+1: 4d} - {object_name}")
|
|
261
|
+
else:
|
|
262
|
+
print(delim.join(list_of_objects))
|
|
246
263
|
elif args.task == "set_tags":
|
|
247
264
|
success = set_tags(
|
|
248
265
|
args.object_name,
|
|
249
266
|
args.tags,
|
|
267
|
+
verbose=args.verbose == 1,
|
|
250
268
|
)
|
|
251
269
|
elif args.task == "transition":
|
|
252
270
|
success = transition(
|
bluer_objects/mlflow/logging.py
CHANGED
|
@@ -17,6 +17,9 @@ def log_artifacts(
|
|
|
17
17
|
object_name: str,
|
|
18
18
|
model_name: str = "",
|
|
19
19
|
) -> bool:
|
|
20
|
+
if env.MLFLOW_IS_SERVERLESS:
|
|
21
|
+
return True
|
|
22
|
+
|
|
20
23
|
if not start_run(object_name):
|
|
21
24
|
return False
|
|
22
25
|
|
|
@@ -49,6 +52,9 @@ def log_artifacts(
|
|
|
49
52
|
|
|
50
53
|
|
|
51
54
|
def log_run(object_name: str) -> bool:
|
|
55
|
+
if env.MLFLOW_IS_SERVERLESS:
|
|
56
|
+
return True
|
|
57
|
+
|
|
52
58
|
if not start_run(object_name):
|
|
53
59
|
return False
|
|
54
60
|
|
bluer_objects/mlflow/models.py
CHANGED
|
@@ -5,6 +5,7 @@ from blueness import module
|
|
|
5
5
|
from bluer_options.logger import crash_report
|
|
6
6
|
|
|
7
7
|
from bluer_objects import NAME
|
|
8
|
+
from bluer_objects import env
|
|
8
9
|
from bluer_objects.logger import logger
|
|
9
10
|
|
|
10
11
|
NAME = module.name(__file__, NAME)
|
|
@@ -14,6 +15,9 @@ def list_registered_models() -> Tuple[
|
|
|
14
15
|
bool,
|
|
15
16
|
List[str],
|
|
16
17
|
]:
|
|
18
|
+
if env.MLFLOW_IS_SERVERLESS:
|
|
19
|
+
return True, []
|
|
20
|
+
|
|
17
21
|
try:
|
|
18
22
|
client = MlflowClient()
|
|
19
23
|
return True, [dict(rm)["name"] for rm in client.search_registered_models()]
|
|
@@ -29,6 +33,9 @@ def transition(
|
|
|
29
33
|
stage_name: str,
|
|
30
34
|
description: str,
|
|
31
35
|
) -> bool:
|
|
36
|
+
if env.MLFLOW_IS_SERVERLESS:
|
|
37
|
+
return True
|
|
38
|
+
|
|
32
39
|
logger.info(
|
|
33
40
|
'{}.transition: {}(#{}) -> {} - "{}")'.format(
|
|
34
41
|
NAME,
|