mirror of
https://github.com/clearml/clearml-server
synced 2025-03-03 18:54:20 +00:00
Fix internal export utility
This commit is contained in:
parent
111d80e88d
commit
fe1c963eec
@ -57,6 +57,10 @@ class PrePopulate:
|
|||||||
metadata_filename = "metadata.json"
|
metadata_filename = "metadata.json"
|
||||||
zip_args = dict(mode="w", compression=ZIP_BZIP2)
|
zip_args = dict(mode="w", compression=ZIP_BZIP2)
|
||||||
artifacts_ext = ".artifacts"
|
artifacts_ext = ".artifacts"
|
||||||
|
img_source_regex = re.compile(
|
||||||
|
r"['\"]source['\"]:\s?['\"](https?://(?:localhost:8081|files.*?)/.*?)['\"]",
|
||||||
|
flags=re.IGNORECASE,
|
||||||
|
)
|
||||||
|
|
||||||
class JsonLinesWriter:
|
class JsonLinesWriter:
|
||||||
def __init__(self, file: BinaryIO):
|
def __init__(self, file: BinaryIO):
|
||||||
@ -360,6 +364,8 @@ class PrePopulate:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def update_featured_projects_order(cls):
|
def update_featured_projects_order(cls):
|
||||||
featured_order = config.get("services.projects.featured_order", [])
|
featured_order = config.get("services.projects.featured_order", [])
|
||||||
|
if not featured_order:
|
||||||
|
return
|
||||||
|
|
||||||
def get_index(p: Project):
|
def get_index(p: Project):
|
||||||
for index, entry in enumerate(featured_order):
|
for index, entry in enumerate(featured_order):
|
||||||
@ -502,11 +508,19 @@ class PrePopulate:
|
|||||||
break
|
break
|
||||||
scroll_id = res.next_scroll_id
|
scroll_id = res.next_scroll_id
|
||||||
for event in res.events:
|
for event in res.events:
|
||||||
if event.get("type") == "training_debug_image":
|
event_type = event.get("type")
|
||||||
|
if event_type == "training_debug_image":
|
||||||
url = cls._get_fixed_url(event.get("url"))
|
url = cls._get_fixed_url(event.get("url"))
|
||||||
if url:
|
if url:
|
||||||
event["url"] = url
|
event["url"] = url
|
||||||
artifacts.append(url)
|
artifacts.append(url)
|
||||||
|
elif event_type == "plot":
|
||||||
|
plot_str: str = event.get("plot_str", "")
|
||||||
|
for match in cls.img_source_regex.findall(plot_str):
|
||||||
|
url = cls._get_fixed_url(match)
|
||||||
|
if match != url:
|
||||||
|
plot_str = plot_str.replace(match, url)
|
||||||
|
artifacts.append(url)
|
||||||
w.write(json.dumps(event))
|
w.write(json.dumps(event))
|
||||||
data = f.getvalue()
|
data = f.getvalue()
|
||||||
hash_.update(data)
|
hash_.update(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user