-
Notifications
You must be signed in to change notification settings - Fork 220
Use dedicated option to download iso and hdd with archive subcommand #6672
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
base: master
Are you sure you want to change the base?
Conversation
6c617b4 to
0422e9f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6672 +/- ##
==========================================
- Coverage 99.22% 99.21% -0.01%
==========================================
Files 398 398
Lines 40876 40886 +10
==========================================
+ Hits 40558 40567 +9
- Misses 318 319 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c3ec1ac to
9bfaea4
Compare
|
|
||
| $path->child('testresults', 'thumbnails')->make_path if $options->{'with-thumbnails'}; | ||
| $self->_download_assets($url, $job, $path); | ||
| $self->_download_assets($url, $job, $path) if $options->{'no-limit'}; |
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 is very misleading. --no-limit implies this is about the size. But the code no longer downloads assets by default.
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 suggest to clarify what behavior we want. The PR description is not clear right now.
For instance "Only download test results by default unless --download-assets is specified".
And maybe --no-limit should really only set asset-size-limit=0? That's what I would expect as a user without digging through the code.
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.
And if this ends up breaking compatibility it needs to be announced to a wider audience. Assuming people use this command and rely on it 🙃
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.
just copied the answer from another comment.
- by default download only testresults with limits.
- download assets only with an explicit parameter which overrides the size limits. Side-effects will reset size limits for testresults as well.
it needs to be announced to a wider audience.
I will ask for reviews in the eng-testing, if this is good enough
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.
Did this happen? 🤔 I don't see any related comments here
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 also find this misleading. It would make sense to have an additional flag like $options->{'no-download'}. If you really want/need to change the default behavior than you could turn the flag around. Or you make it behave like this in case of --asset-size-limit 0 as suggested by @kalikiana (which could still be combined with my suggestion for --asset-size-limit infinity).
9bfaea4 to
439c53d
Compare
public/openqa-cli.yaml
Outdated
| options: | ||
| - asset-size-limit|l=i --Asset size limit in bytes | ||
| - with-thumbnails|t --Download thumbnails as well | ||
| - no-limit|u --Download all assets without size limits |
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.
Please align with the other options.
t/43-cli-archive.t
Outdated
| use OpenQA::CLI::archive; | ||
| use OpenQA::Test::Case; | ||
| use OpenQA::Test::TimeLimit '10'; | ||
| use OpenQA::Utils qw(:DEFAULT assetdir); |
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.
Why are you importing everything with :DEFAULT? I think you only need assetdir(), right?
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.
yea I just copy paste but forgot to remove it. will fix
t/43-cli-archive.t
Outdated
| my $target = $dir->child('archive-with-assets')->make_path; | ||
| my ($stdout, $stderr, @result) | ||
| = capture_stdout sub { $cli->run('archive', @host, '--no-limit', 99963, $target->to_string) }; | ||
| like $stdout, qr{Downloading.*\/iso\/openSUSE-13.1-DVD-x86_64-Build0091-Media.iso}, |
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.
| like $stdout, qr{Downloading.*\/iso\/openSUSE-13.1-DVD-x86_64-Build0091-Media.iso}, | |
| like $stdout, qr{Downloading.*/iso/openSUSE-13.1-DVD-x86_64-Build0091-Media.iso}, |
70c6f1c to
6358204
Compare
lib/OpenQA/Client/Archive.pm
Outdated
| $options->{'asset-size-limit'} //= $default_max_asset_size; | ||
| $self->client->max_response_size($options->{'asset-size-limit'}); | ||
| $options->{'no-limit'} //= 0; | ||
| $self->client->max_response_size($options->{all} ? 0 : $options->{'asset-size-limit'}); |
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.
Where is $options->{all} set? It doesn't show up on openqa-cli archive -h and it also doesn't look like this PR is introducing it. And wouldn't it make sense to let the user simply specify --asset-size-limit 0 instead of having this special case?
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.
Where is $options->{all} set?
variable renamed and I missed to update this. fixed.
And wouldn't it make sense to let the user simply specify --asset-size-limit 0 instead of having this special case?
Actually it makes sense, even if there is nothing wrong having two variables. To me, --asset-size-limit 0 looks unclear and confusing. Initially I was looking for a name that indicates download of isos and hdds. I went with the suggestions at the end.
148f20f to
46e9556
Compare
Based on the history this did not meant to download other assets than 'other' assets and it is implemeted using the `asset-size-limit` parameter, which was set in a quite small size. os-autoinst#1571 (comment) With this size in place, the error is confusing and not intuitive. It makes more sense to remove the limit in case you want to get the full assets. - Introduce `--no-limit` to skip _asset-size-limit_ - by default download only testresults with limits. - download assets only with an explicit parameter which overrides the size limits. Side-effects will reset size limits for testresults as well. Signed-off-by: Ioannis Bonatakis <[email protected]>
46e9556 to
8c7879f
Compare
| $options->{'asset-size-limit'} //= $default_max_asset_size; | ||
| $self->client->max_response_size($options->{'asset-size-limit'}); | ||
| $options->{'no-limit'} //= 0; | ||
| $self->client->max_response_size($options->{'no-limit'} ? 0 : $options->{'asset-size-limit'}); |
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.
Ok, so this was really just mean to be no-limit. I must still say I don't like the extra flag that makes the code ignore --asset-size-limit. It is always better to minimize interactions between flags. So I'd suggest to either:
- Make this at least more explicit.
- Call the flag
--no-asset-size-limitto make it clear that it relates to the--asset-size-limit. - Perhaps check whether both arguments are specified and print a hard error in this case (as it makes never sense to specify both of these arguments at the same time).
- Call the flag
- Follow my previous suggestion and just allow
--asset-size-limit 0. The help text could mention the special meaning of0. That0means "unlimited" is conventional and we also already follow this convention in other places. Mojolicious follows this convention as well hence this way we needed zero code changes to make this actually work.- If you don't like
0you could add code like$options->{'asset-size-limit'} eq 'infinity' ? 0 : $options->{'asset-size-limit'}and make this way insteadinfinitya special value.
- If you don't like
|
|
||
| $path->child('testresults', 'thumbnails')->make_path if $options->{'with-thumbnails'}; | ||
| $self->_download_assets($url, $job, $path); | ||
| $self->_download_assets($url, $job, $path) if $options->{'no-limit'}; |
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 also find this misleading. It would make sense to have an additional flag like $options->{'no-download'}. If you really want/need to change the default behavior than you could turn the flag around. Or you make it behave like this in case of --asset-size-limit 0 as suggested by @kalikiana (which could still be combined with my suggestion for --asset-size-limit infinity).
|
I wonder if at this point this should be closed. Or maybe it is worth asking for feedback from a wider audience since there's no consensus on the changes? |
I will bring it up in the collab |
Based on the history this did not meant to download other assets than 'other'
assets and it is implemeted using the
asset-size-limitparameter, which wasset in a quite small size.
#1571 (comment)
With this size in place, the error is confusing and not intuitive. It makes
more sense to remove the limit in case you want to get the full assets.
--allno-limitto skip asset-size-limit. short-uas unlimit