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

Fix syncing offline runs with file upload #1211

Merged
merged 12 commits into from Feb 13, 2023
Merged

Conversation

shnela
Copy link
Contributor

@shnela shnela commented Feb 9, 2023

No description provided.

@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Base: 79.55% // Head: 71.51% // Decreases project coverage by -8.04% ⚠️

Coverage data is based on head (2f1fe99) compared to base (140bea3).
Patch coverage: 95.12% of modified lines in pull request are covered.

❗ Current head 2f1fe99 differs from pull request most recent head a59260d. Consider uploading reports for the commit a59260d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1211      +/-   ##
==========================================
- Coverage   79.55%   71.51%   -8.04%     
==========================================
  Files         288      288              
  Lines       13624    13641      +17     
==========================================
- Hits        10838     9756    -1082     
- Misses       2786     3885    +1099     
Flag Coverage Δ
e2e ?
unit ?
unit-pull-request 71.51% <95.12%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/neptune/new/attributes/atoms/file.py 100.00% <ø> (ø)
.../operation_processors/async_operation_processor.py 92.00% <ø> (-1.34%) ⬇️
src/neptune/new/internal/operation.py 95.81% <90.90%> (-0.98%) ⬇️
src/neptune/new/cli/sync.py 87.93% <100.00%> (-2.42%) ⬇️
...ne/new/internal/backends/hosted_neptune_backend.py 42.43% <100.00%> (-35.27%) ⬇️
...c/neptune/new/internal/backends/neptune_backend.py 71.90% <100.00%> (+0.23%) ⬆️
...tune/new/internal/backends/neptune_backend_mock.py 85.08% <100.00%> (+0.07%) ⬆️
...internal/operation_processors/operation_storage.py 91.17% <100.00%> (+0.85%) ⬆️
...l/operation_processors/sync_operation_processor.py 94.11% <100.00%> (ø)
...eptune/common/websockets/reconnecting_websocket.py 27.77% <0.00%> (-65.28%) ⬇️
... and 101 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@shnela shnela marked this pull request as draft February 9, 2023 21:21
src/neptune/new/cli/sync.py Outdated Show resolved Hide resolved
src/neptune/new/cli/sync.py Outdated Show resolved Hide resolved
src/neptune/new/internal/operation.py Outdated Show resolved Hide resolved
src/neptune/new/internal/operation.py Show resolved Hide resolved
@shnela shnela marked this pull request as ready for review February 10, 2023 20:45
@@ -522,7 +526,7 @@ def _execute_upload_operations(
swagger_client=self.leaderboard_client,
container_id=container_id,
attribute=path_to_str(op.path),
source=op.file_path,
source=op.get_absolute_path(operation_storage),
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like both - clear and get_absolute_path should be defined in OperationStorage. Operation should be a simple serializable dataclass with minimum logic. And it would be better to pass operation object instead of raw path as an argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll give it a try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But if we define clear and get_absolute_path in OperationStorage we'll have to pass Operation (in particular UploadFile) to those functions because we would like to clear or get path of particular operation.

At the same time we need upload_path of OperationStorage when creating operation (when we create UploadFile of in-memory file we also save file to .neptune catalog).

It'll require OperationStorage to be some kind of proxy on UploadFile operation irresponsible also for creating it.

If you're ok with that I can do that, what do you think?

)
tmp_file_name = cls.get_tmp_file_name(attribute_path, value.extension)
value._save(upload_path / tmp_file_name)
operation = UploadFile(path=attribute_path, ext=value.extension, tmp_file_name=tmp_file_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

clean_after_upload is missing. Is it intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Now we determine if operation should be cleaned by existence of tmp_file_name value.

clean_after_upload is deprecated flag leaved only for handling of old format operations if user invoke sync on old data.

file_path: str
file_path: str = None
tmp_file_name: str = None
# `clean_after_upload` is for backward compatibility and should be removed in the future
clean_after_upload: bool = False

@classmethod
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe pass OperationStorage instead of upload_path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, why not.

aniezurawski
aniezurawski previously approved these changes Feb 13, 2023
aniezurawski
aniezurawski previously approved these changes Feb 13, 2023
@shnela shnela merged commit e47ee36 into master Feb 13, 2023
@shnela shnela deleted the jk/upload-from-offline branch February 13, 2023 10:28
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