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

[tune] logger refactor part 3: Add ExperimentLogger class #11749

Merged
merged 22 commits into from
Nov 5, 2020

Conversation

krfricke
Copy link
Contributor

@krfricke krfricke commented Nov 2, 2020

Why are these changes needed?

Second split of PR ##11699, builds on #11748

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Kai Fricke added 7 commits November 2, 2020 20:26
# Conflicts:
#	python/ray/tune/logger.py
# Conflicts:
#	python/ray/tune/logger.py
#	python/ray/tune/utils/callback.py
# Conflicts:
#	python/ray/tune/callback.py
#	python/ray/tune/logger.py
#	python/ray/tune/tests/test_cluster.py
@richardliaw
Copy link
Contributor

(needs a quick rebase?)

@richardliaw richardliaw added the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Nov 4, 2020
Kai Fricke added 3 commits November 4, 2020 10:08
…er-3

# Conflicts:
#	python/ray/tune/logger.py
#	python/ray/tune/syncer.py
#	python/ray/tune/trial.py
#	python/ray/tune/tune.py
#	python/ray/tune/utils/callback.py
@krfricke krfricke removed the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Nov 4, 2020
# Todo(krfricke): Deprecate `loggers` argument, print warning here.
add_loggers = []
for trial_logger in loggers:
if isinstance(trial_logger, ExperimentLogger):
Copy link
Contributor

Choose a reason for hiding this comment

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

When will users pass an ExperimentLogger via loggers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They shouldn', but they might, so I guess we should handle this. We could also raise an error here instead

has_csv_logger = True
if JsonLogger in callback.logger_classes:
has_json_logger = True
# Todo(krfricke): add checks for new ExperimentLogger classes
Copy link
Contributor

@richardliaw richardliaw Nov 4, 2020

Choose a reason for hiding this comment

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

will this todo be part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this will be a follow up once we implemented a "native" CSV/JSON ExperimentLogger

Comment on lines +83 to +93
if syncer_index is not None and last_logger_index is not None and \
syncer_index < last_logger_index:
if (not has_csv_logger or not has_json_logger) and not loggers:
# Only raise the warning if the loggers were passed by the user.
# (I.e. don't warn if this was automatic behavior and they only
# passed a customer SyncerCallback).
raise ValueError(
"The `SyncerCallback` you passed to `tune.run()` came before "
"at least one `ExperimentLogger`. Syncing should be done "
"after writing logs. Please re-order the callbacks so that "
"the `SyncerCallback` comes after any `ExperimentLogger`.")
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, can we just make sure the syncer is last?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what we do here, right? If someone passes callbacks=[syncer, logger] it will raise an error. If someone passes callbacks=[syncer] and the logger is created automatically, it will just put the syncer last and everything will work.

Copy link
Contributor

@richardliaw richardliaw 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, after nits

@krfricke krfricke mentioned this pull request Nov 5, 2020
7 tasks
@richardliaw richardliaw merged commit 603accf into ray-project:master Nov 5, 2020
@krfricke krfricke deleted the tune-logger-3 branch November 9, 2020 11:16
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.

None yet

2 participants