-
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: add options --dry_run and --one_shot #3707
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3ebd9e0
uploader: add --dry_run and --one_shot options
caisq b63ff1e
Improve code and doc strings
caisq 59c6d43
Add warning for no data under one-shot
caisq 9d9ba8d
Remove unused code
caisq fbc9dc9
Remove unused code (the sequel)
caisq 6986a6b
Simplify test
caisq 3bb99d0
Address comments
caisq f2d1204
Merge branch 'master' into uploader-dry-run
caisq 7593c9d
Remove unused dep and import
caisq 78dc9e1
Trigger Build
caisq a70d713
Trigger Build
caisq 6d33174
Remove duplicate method
caisq c38fde9
Merge branch 'master' into uploader-dry-run
caisq 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
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
"""Dry-run stubs for various rpc services.""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
from tensorboard.uploader.proto import write_service_pb2 | ||
from tensorboard.uploader.proto import write_service_pb2_grpc | ||
|
||
|
||
class DryRunTensorBoardWriterStub(object): | ||
"""A dry-run TensorBoardWriter gRPC Server. | ||
|
||
Only the methods used by the `tensorboard dev upload` are | ||
mocked out in this class. | ||
|
||
When additional methods start to be used by the command, | ||
their mocks should be added to this class. | ||
""" | ||
|
||
def CreateExperiment(self, request, **kwargs): | ||
"""Create a new experiment and remember it has been created.""" | ||
del request, kwargs # Unused. | ||
return write_service_pb2.CreateExperimentResponse() | ||
|
||
def WriteScalar(self, request, **kwargs): | ||
del request, kwargs # Unused. | ||
return write_service_pb2.WriteScalarResponse() | ||
|
||
def WriteTensor(self, request, **kwargs): | ||
del request, kwargs # Unused. | ||
return write_service_pb2.WriteTensorResponse() | ||
|
||
def GetOrCreateBlobSequence(self, request, **kwargs): | ||
del request, kwargs # Unused. | ||
return write_service_pb2.GetOrCreateBlobSequenceResponse( | ||
blob_sequence_id="dummy_blob_sequence_id" | ||
) | ||
|
||
def WriteBlob(self, request, **kwargs): | ||
del kwargs # Unused. | ||
for item in request: | ||
yield write_service_pb2.WriteBlobResponse() |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
"""Tests for dry-run rpc servicers.""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
from tensorboard import test as tb_test | ||
from tensorboard.uploader import dry_run_stubs | ||
from tensorboard.uploader.proto import write_service_pb2 | ||
|
||
|
||
class DryRunTensorBoardWriterServicerTest(tb_test.TestCase): | ||
def setUp(self): | ||
super(DryRunTensorBoardWriterServicerTest, self).setUp() | ||
self._stub = dry_run_stubs.DryRunTensorBoardWriterStub() | ||
|
||
def testCreateExperiment(self): | ||
self._stub.CreateExperiment(write_service_pb2.CreateExperimentRequest()) | ||
|
||
def testWriteScalar(self): | ||
self._stub.WriteScalar(write_service_pb2.WriteScalarRequest()) | ||
|
||
def testWriteTensor(self): | ||
self._stub.WriteTensor(write_service_pb2.WriteTensorRequest()) | ||
|
||
def testGetOrCreateBlobSequence(self): | ||
self._stub.GetOrCreateBlobSequence( | ||
write_service_pb2.GetOrCreateBlobSequenceRequest() | ||
) | ||
|
||
def testWriteBlob(self): | ||
def dummy_iterator(): | ||
yield write_service_pb2.WriteBlobRequest() | ||
yield write_service_pb2.WriteBlobRequest() | ||
|
||
for response in self._stub.WriteBlob(dummy_iterator()): | ||
self.assertTrue(response) | ||
|
||
|
||
if __name__ == "__main__": | ||
tb_test.main() |
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
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
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.
I'm a little surprised that all the responses can be empty here (except the BlobSequence case, I see). OK, assuming you've tested a dry run with scalar, tensor, and blob data.
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.
Yep. Manually tested such logdirs with
--dry_run
.