-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
uploader: display upload statistics while uploading data #3678
Conversation
cc @GalOshri |
tensorboard/uploader/uploader.py
Outdated
@@ -503,7 +534,12 @@ def flush(self): | |||
|
|||
self._rpc_rate_limiter.tick() | |||
|
|||
with _request_logger(request, request.runs): | |||
with contextlib.ExitStack() as stack: |
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.
Took me a bit to figure out why you did it this way :) I think it's because self._tracker
might be None
, so you can't just with self._tracker.scalars_tracker(...):
.
I think this would be clearer, more idiomatic, and more flexible if you don't allow self._tracker
to be None, but instead push the verbosity argument down into UploadTracker and handle it there (i.e., checking the condition only when it comes time to actually print something). Then all of these ExitStack things go away and you can just say
with _request_logger(request, request.runs):
with self._tracker.scalars_tracker(self._num_values):
...
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.
Done. This increases the maximum depth of ident by 1. But I think it's worth the benefits you pointed out.
tensorboard/uploader/uploader.py
Outdated
@@ -157,6 +163,9 @@ def create_experiment(self): | |||
response = grpc_util.call_with_retries( | |||
self._api.CreateExperiment, request | |||
) | |||
self._tracker = ( |
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.
Per comment below, how about
self._tracker = upload_tracker.UploadTracker(self._verbosity)
(and all the consequences of that refactoring)
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.
Done.
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.
Thanks for the review!
tensorboard/uploader/uploader.py
Outdated
@@ -503,7 +534,12 @@ def flush(self): | |||
|
|||
self._rpc_rate_limiter.tick() | |||
|
|||
with _request_logger(request, request.runs): | |||
with contextlib.ExitStack() as stack: |
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.
Done. This increases the maximum depth of ident by 1. But I think it's worth the benefits you pointed out.
tensorboard/uploader/uploader.py
Outdated
@@ -157,6 +163,9 @@ def create_experiment(self): | |||
response = grpc_util.call_with_retries( | |||
self._api.CreateExperiment, request | |||
) | |||
self._tracker = ( |
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.
Done.
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.
Nice! Very thorough tests, too :)
tensorboard/uploader/uploader.py
Outdated
sent_blobs += self._send_blob( | ||
blob_sequence_id, seq_index, blob | ||
) | ||
if self._tracker: |
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.
this condition is no longer needed
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.
Done.
tensorboard/uploader/uploader.py
Outdated
@@ -594,6 +622,7 @@ def __init__( | |||
rpc_rate_limiter, | |||
max_request_size, | |||
max_tensor_point_size, | |||
tracker=None, |
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.
Don't default to None, now that this is required
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.
Done. Same for another line like this.
tensorboard/uploader/uploader.py
Outdated
api, | ||
rpc_rate_limiter, | ||
max_request_size, | ||
tracker=None, |
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.
Don't default to None, now that this is required
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.
Done.
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.
Thanks for the review!
tensorboard/uploader/uploader.py
Outdated
api, | ||
rpc_rate_limiter, | ||
max_request_size, | ||
tracker=None, |
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.
Done.
tensorboard/uploader/uploader.py
Outdated
@@ -594,6 +622,7 @@ def __init__( | |||
rpc_rate_limiter, | |||
max_request_size, | |||
max_tensor_point_size, | |||
tracker=None, |
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.
Done. Same for another line like this.
I've removed the usage of tqdm, because of two reasons
|
tqdm
:--verbose 0
to overridethe default value 1
upload_tracker.py
to encapsulate the logic for stats trackingand display.
uploader.py
module