Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete function to API #662

Merged
merged 9 commits into from
Jun 5, 2022
Merged

Conversation

LordDarkula
Copy link
Contributor

Remove an artifact from artifact store as well as
removing value from both database and pickle store if
no other artifacts refer to it.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Remove an artifact from artifact store as well as
removing value from both database and pickle store if
no other artifacts refer to it.
@LordDarkula LordDarkula marked this pull request as draft June 1, 2022 00:44
LordDarkula and others added 5 commits May 31, 2022 18:03
A KeyError can be raised instead when the pickle file is not found at
the expected location.
There might be a bug with artifact versions so the tests with hardcoded
versions are xfailed.
Allow user to pass in all as a string into the version parameter
of delete to delete all versions of an artifact.
* Fixing pytorch dependencies for integration tests

* Fixing comments for pytorch integration tests
Copy link
Contributor

@yifanwu yifanwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had one Q about artifact saving behavior on the same node, otherwise looks great. cc @lionsardesai

@@ -94,7 +94,11 @@ def save(reference: object, name: str) -> LineaArtifact:
node_id=value_node_id, execution_id=execution_id
):
# can raise ArtifactSaveException

# pickles value of artifact and saves to filesystem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prob should have renamed the function name since it's not db but rather file path


def _try_delete_from_db(pickled_path: Path) -> None:
if pickled_path.exists():
pickled_path.unlink()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -470,6 +470,24 @@ def node_value_in_db(
.exists()
).scalar()

def number_of_artifacts_per_node(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know whether a new pickle gets created when the .save is called on the same node multiple times?

self, artifact_name: str, version: Union[int, str] = None
):
"""
Deletes the most recent artifact with a certain name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description doesn't include a reference to "all" and "latest"?

I don't really like the design using strings but it's fine for now.

@@ -49,7 +49,9 @@ class Environment:
pip=["gym[atari]"],
),
"pytorch": lambda: Environment(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird that the diff is showing up... maybe you haven't rebased yet with main (I thought this was merged already)?

@mingjerli mingjerli marked this pull request as ready for review June 4, 2022 17:35
@yifanwu yifanwu merged commit 19e1015 into main Jun 5, 2022
@lionsardesai lionsardesai deleted the LIN-425-add-artifact-delete-functionality branch June 6, 2022 20:39
@LordDarkula LordDarkula restored the LIN-425-add-artifact-delete-functionality branch June 6, 2022 20:51
@dorx
Copy link
Contributor

dorx commented Jun 6, 2022

fixes #659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants