-
Notifications
You must be signed in to change notification settings - Fork 321
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
Implement copy_to
and move_to
for S3_File
#9054
Conversation
8156f3c
to
dc54ea0
Compare
1042d0c
to
dd6049e
Compare
I mentioned that the tests are a bit slow (running for almost 3 minutes). We could try re-using existing objects a bit more to make it more efficient, but that could complicate the structure of the tests so much that I'm not sure if it's worth it. After all 3 minutes is not that bad, although not ideal if it means 3 minutes added to every CI run... |
To better understand the timing of the operations, I temporarily added measurement facilities (a1577dc) and checked various operations in the REPL:
We can see that usually a single operation seems to take around 0.7s. Backup (default...) strategy is the worst case because it requires 3 'primitive' operations - exists+copy+upload if the file already exists and 2 if it doesn't (exists+upload). Overwrite is much faster as it just does 1 primitive op: upload without any checks. |
I tried using the VisualVM for profiling (well, polyglot sampling to be exact) but tbh I cannot quite interpret the results. The profile above is generated with operation:
@JaroslavTulach do you see any obvious mistakes I may have made here in the approach to sampling the application? Can I do something to also reasonably measure the wait times and Java-polyglot calls? |
As far as I could have measured using the available tools, I think that the ~0.7s per request timings are just due to S3 being slow and requiring long round-trips, and not due to some anomalies in our implementation. As for the tests taking a lot of time - I guess that is quite expected from tests that need to phone external services and I think we need to think of implementing the strategy that we were considering for additional DB backends - of running these tests on the nightly builds + on-demand on CI only when we modify related logic (e.g. triggered by adding a label to the PR). This way these tests will not clog our main CI process too much. I don't think we can make the tests less resource intensive, as we just need good coverage to avoid bugs and being more 'frugal' about re-using S3 resources will risk making the tests harder to understand and maintain. |
I believe that's the expected behavior. The thing you call polyglot-Java isn't polyglot from the Polyglot Sampler perspective. |
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.
Looks good.
destination file already exists. Defaults to `False`. | ||
move_to : Writable_File -> Boolean -> Nothing ! File_Error | ||
move_to self (destination : Writable_File) (replace_existing : Boolean = False) = | ||
if Context.Output.is_enabled.not then Error.throw (Forbidden_Operation.Error "File moving is forbidden as the Output context is disabled.") else |
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.
Not for this one, but I feel like we need a better construct for this. Something like
if Context.Output.is_enabled.not then Error.throw (Forbidden_Operation.Error "File moving is forbidden as the Output context is disabled.") else | |
Context.Output.when_enabled disabled_message="File moving is forbidden as the Output context is disabled.") <| |
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.
Good idea, I created a ticket so that we can pick it up whenever we can: #9080
Pull Request Description
File.copy_to
should allow to upload/download files across 'remote' backends #8833Enso_File
will only be added once we implement Enso_File writing.Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.