Skip to content

Commit

Permalink
skip export of already existing artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Oct 20, 2024
1 parent dfb8e67 commit 41fac10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mlonmcu/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def uncache(self):
self.raw = None
# TODO: logging msg

def export(self, dest, extract=False):
def export(self, dest, extract=False, skip_exported: bool = True):
"""Export the artifact to a given path (file or directory) and update its path.
Arguments
Expand All @@ -152,6 +152,12 @@ def export(self, dest, extract=False):
filename = dest / self.name
else:
filename = dest
if self.exported and not extract:
assert self.path is not None
if self.path == filename:
if self.path.is_file() or self.path.is_dir():
if skip_exported:
return
if self.fmt in [ArtifactFormat.TEXT, ArtifactFormat.SOURCE]:
assert not extract, "extract option is only available for ArtifactFormat.MLF"
with open(filename, "w", encoding="utf-8") as handle:
Expand Down

0 comments on commit 41fac10

Please sign in to comment.