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

[BC] Refactor _KEEP_TEMPS for reusability #376

Merged
merged 20 commits into from
Oct 2, 2024

Conversation

tvmarino
Copy link
Collaborator

@tvmarino tvmarino commented Oct 1, 2024

Patch that adds the option to keep temporary working_dir in env.py and adds working_dir as part of TimeStep in env.py

tvmarino and others added 17 commits September 3, 2024 20:16
given by combine_tfa_policies_lib.get_input_signature()
and action spec given by combine_tfa_policies_lib.get_action_spec()
The combiner policy uses a new timestep spec feature "model_selector"
to select the requested policy at the current state. The feature is
computed as a md5 hash from the respective policies names.
TimeStep. The patch also gives the option to keep the temporary
working_dir by setting keep_temps in compilation_runner.py to a
directory where all temporary working_dirs will be saved.
Copy link
Collaborator

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

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

looks good, just 2 comments, feel free to land after addressing them.

@@ -80,6 +80,18 @@ def __exit__(self, exc, value, tb):
pass


def get_directory_context():
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rename this to be more specific, how about get_workdir_context (otherwise... lots of directories, so which one is this :) )

self.assertEqual(os.path.exists(working_dir), False)

with flagsaver.flagsaver(
(env.compilation_runner._KEEP_TEMPS, '/tmp')): # pylint: disable=protected-access
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you use instead of /tmp self.create_tempdir()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you check if this looks good now?

@mtrofin
Copy link
Collaborator

mtrofin commented Oct 1, 2024

Can you rename also the title of the change to e.g. "factor _KEEP_TEMP for reusability" or something in that vein

@tvmarino tvmarino changed the title Behavior cloning [BC] Refactor _KEEP_TEMP for reusability Oct 1, 2024
Copy link
Collaborator

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

One minor nit, otherwise LGTM.

"""Return a context which manages how the temperory directories are handled.

When the flag keep_temps is specified temporary directories are stored in
keep_temps."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: The """ string terminator should be on a separate line.

@mtrofin mtrofin changed the title [BC] Refactor _KEEP_TEMP for reusability [BC] Refactor _KEEP_TEMPS for reusability Oct 2, 2024
@tvmarino tvmarino merged commit 08e6242 into google:main Oct 2, 2024
15 checks passed
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.

3 participants