-
Notifications
You must be signed in to change notification settings - Fork 764
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
remove setting of metadata in Runner #2107
Open
madhur-ob
wants to merge
4
commits into
Netflix:master
Choose a base branch
from
madhur-ob:remove-metadata-runner
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+17
−8
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,13 +269,19 @@ def __init__( | |
_parent: Optional["MetaflowObject"] = None, | ||
_namespace_check: bool = True, | ||
_current_namespace: Optional[str] = None, | ||
_current_metadata: Optional[str] = None, | ||
): | ||
self._metaflow = Metaflow() | ||
self._parent = _parent | ||
self._path_components = None | ||
self._attempt = attempt | ||
self._current_namespace = _current_namespace or get_namespace() | ||
self._current_metadata = _current_metadata or get_metadata() | ||
self._namespace_check = _namespace_check | ||
|
||
# Set the metadata being passed.. | ||
metadata(self._current_metadata) | ||
|
||
# If the current namespace is False, we disable checking for namespace for this | ||
# and all children objects. Not setting namespace_check to False has the consequence | ||
# of preventing access to children objects after the namespace changes | ||
|
@@ -394,6 +400,7 @@ def __iter__(self) -> Iterator["MetaflowObject"]: | |
_current_namespace=( | ||
self._current_namespace if self._namespace_check else None | ||
), | ||
_current_metadata=self._current_metadata, | ||
) | ||
for obj in unfiltered_children | ||
), | ||
|
@@ -509,6 +516,7 @@ def __getitem__(self, id: str) -> "MetaflowObject": | |
_current_namespace=( | ||
self._current_namespace if self._namespace_check else None | ||
), | ||
_current_metadata=self._current_metadata, | ||
) | ||
else: | ||
raise KeyError(id) | ||
|
@@ -540,16 +548,17 @@ def _unpickle_284(self, data): | |
) | ||
|
||
def _unpickle_2124(self, data): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to add another version of course. So we can unpickle all versions of objects. |
||
if len(data) != 4: | ||
if len(data) != 5: | ||
raise MetaflowInternalError( | ||
"Unexpected size of array: {}".format(len(data)) | ||
) | ||
pathspec, attempt, ns, namespace_check = data | ||
pathspec, attempt, ns, namespace_check, metadata = data | ||
self.__init__( | ||
pathspec=pathspec, | ||
attempt=attempt, | ||
_namespace_check=namespace_check, | ||
_current_namespace=ns, | ||
_current_metadata=metadata, | ||
) | ||
|
||
_UNPICKLE_FUNC = {"2.8.4": _unpickle_284, "2.12.4": _unpickle_2124} | ||
|
@@ -579,6 +588,7 @@ def __setstate__(self, state): | |
attempt=state.get("_attempt", None), | ||
_namespace_check=state.get("_namespace_check", False), | ||
_current_namespace=None, | ||
_current_metadata=None, | ||
) | ||
|
||
def __getstate__(self): | ||
|
@@ -601,6 +611,7 @@ def __getstate__(self): | |
self._attempt, | ||
self._current_namespace, | ||
self._namespace_check, | ||
self._current_metadata, | ||
], | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
from typing import Dict, Iterator, Optional, Tuple | ||
|
||
from metaflow import Run, metadata | ||
from metaflow import Run | ||
|
||
from .utils import handle_timeout, clear_and_set_os_environ | ||
from .subprocess_manager import CommandManager, SubprocessManager | ||
|
@@ -284,11 +284,9 @@ def __get_executing_run(self, tfp_runner_attribute, command_obj): | |
# Set the environment variables to what they were before the run executed. | ||
clear_and_set_os_environ(self.old_env) | ||
|
||
# Set the correct metadata from the runner_attribute file corresponding to this run. | ||
metadata_for_flow = content.get("metadata") | ||
metadata(metadata_for_flow) | ||
|
||
run_object = Run(pathspec, _namespace_check=False) | ||
run_object = Run( | ||
pathspec, _namespace_check=False, _current_metadata=content.get("metadata") | ||
) | ||
return ExecutingRun(self, command_obj, run_object) | ||
|
||
def run(self, **kwargs) -> ExecutingRun: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there is something in deployer which is where I ran into it. |
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want to do this at all. Basically, we create a Metaflow object that has self.metadata in it. We want to initialize self.metadata to be the one from self._current_metadata.