-
Notifications
You must be signed in to change notification settings - Fork 26
Add a flag --skip-cached to skip already-downloaded models and collections #461
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: gz-fuel-tools10
Are you sure you want to change the base?
Add a flag --skip-cached to skip already-downloaded models and collections #461
Conversation
Signed-off-by: khaledgabr77 <[email protected]>
…rlds Signed-off-by: khaledgabr77 <[email protected]>
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.
You have introduced many changes which are not related with this PR, do you mind to restore them
@@ -228,7 +229,8 @@ class Cmd | |||
'onlymodels' => '0', | |||
'onlyworlds' => '0', | |||
'defaults' => false, | |||
'console' => false | |||
'console' => false, | |||
'skip_cached' => 'false' |
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.
'skip_cached' => 'false' | |
'skip_cached' => false |
@@ -302,6 +304,9 @@ class Cmd | |||
opts.on('--console', 'Output to console') do | |||
options['console'] = true | |||
end | |||
opts.on('-s', '--skip-cached', 'Skip downloading resources already in cache') do | |||
options['skip_cached'] = 'true' |
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.
options['skip_cached'] = 'true' | |
options['skip_cached'] = true |
@@ -434,9 +439,9 @@ class Cmd | |||
exit(-1) | |||
end | |||
when 'download' | |||
Importer.extern 'int downloadUrl(const char *, const char *, const char *, const char *, unsigned int)' | |||
Importer.extern 'int downloadUrl(const char *, const char *, const char *, const char *, unsigned int, const char *)' |
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.
Importer.extern 'int downloadUrl(const char *, const char *, const char *, const char *, unsigned int, const char *)' | |
Importer.extern 'int downloadUrl(const char *, const char *, const char *, const char *, unsigned int, bool)' |
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.
Hi @ahcorde
I followed the changes you suggested and updated both gz.cc
and gz.hh
to accept a bool parameter. However, when I tried to compile and run the code, I encountered the following issue:
Library error: Problem running [download]() from /root/gz_ws/install/lib/libgz-fuel_tools10.so.10.0.1
I need to determine whether this issue came from the Ruby
script or the C++
implementation. Previously, when reading the file, I noticed that char
was used to represent boolean
values, so I followed the same approach. However, now I plan to recheck the full code to understand exactly where the issue is coming from.
You're right — I forgot to mention that the changes are related to running |
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.
You have introduced many changes which are not related with this PR, do you mind to restore them
You're right — I forgot to mention that the changes are related to running
ament_uncrustify --reformat
. After I finished working on eachC++
file, I applied the reformatting using that command. Do you still want me to revert the changes?
we are not using uncrustify
in gazebo. Yes, restore the changes
I'm sorry for that, i restore changes now. |
0add1b3
to
053fe4c
Compare
Signed-off-by: khaledgabr77 <[email protected]>
053fe4c
to
f3860b9
Compare
I’ve restored the changes and will review the updates you requested later tomorrow. |
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.
some linters are failing
/github/workspace/src/gz.cc:468: Lines should be <= 80 characters long [whitespace/line_length] [2]
/github/workspace/src/gz.cc:515: If/else bodies with multiple statements require braces [readability/braces] [4]
/github/workspace/src/gz.cc:516: Lines should be <= 80 characters long [whitespace/line_length] [2]
/github/workspace/src/gz.cc:559: If/else bodies with multiple statements require braces [readability/braces] [4]
/github/workspace/src/gz.cc:560: Lines should be <= 80 characters long [whitespace/line_length] [2]
/github/workspace/src/gz.cc:658: Lines should be <= 80 characters long [whitespace/line_length] [2]
/github/workspace/src/gz.hh:65: Lines should be <= 80 characters long [whitespace/line_length] [2]
🎉 New feature
Closes #150
Summary
This PR introduces a
--skip-cached
flag option to gz-fuel-tools10 (available through thegz fuel download
command).When the flag is set, any models that already exist in the local cache are skipped instead of downloaded again, saving time.
Both individual model downloads and collection downloads now respect this flag.
Behaviour before this PR
Every time running of
gz fuel download
re-download of all models, even if they were already present locally.Behaviour after this PR
With
--skip-cached
, the CLI first checks the local cache and only downloads the models that are missing.Test it
gz fuel download -j 4 -u "https://fuel.gazebosim.org/1.0/openrobotics/collections/Gazebo classic model database"
gz fuel download -j 4 --skip-cached -u "https://fuel.gazebosim.org/1.0/openrobotics/collections/Gazebo classic model database"
You can repeat the same steps with an individual model URL too.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.