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

APIs for retrieving models in parallel #199

Merged
merged 9 commits into from
Nov 5, 2021
Merged

Conversation

mjcarroll
Copy link
Contributor

🎉 New feature

Closes #188

Summary

Adds APIs for downloading a set of models in parallel.

Test it

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@github-actions github-actions bot added the 🔮 dome Ignition Dome label Aug 16, 2021
@nkoenig nkoenig self-requested a review August 16, 2021 20:26
@nkoenig nkoenig requested a review from jennuine August 30, 2021 20:03
Copy link
Contributor

@jennuine jennuine left a comment

Choose a reason for hiding this comment

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

Looks good so far, appears to be still be in progress. Can this be retarged to Citadel?

if (!this->CachedModel(dependencyURI, dependencyPath))
this->DownloadModel(dependencyURI, dependencyPath);
ModelIdentifier dependencyID;
this->ParseModelUrl(dependencyURI, dependencyID);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check if parsing failed?

}
}
}

return Result(ResultType::FETCH);
}

//////////////////////////////////////////////////
Result FuelClient::DownloadModels(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function not finished? It doesn't appear to be doing anything and isn't being used

const std::vector<std::string> &_headers,
std::vector<ModelIdentifier> &_dependencies);

public: Result DownloadModels(
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing docs

const std::vector<ModelIdentifier> &_ids,
size_t _jobs = 2);

/// \brief Retrieve the list of dependencies for a model.
Copy link
Contributor

Choose a reason for hiding this comment

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

codecheck error: remove line ending whitespace

Suggested change
/// \brief Retrieve the list of dependencies for a model.
/// \brief Retrieve the list of dependencies for a model.

if(!res)
return res;

for (auto dep: dependencies)
Copy link
Contributor

Choose a reason for hiding this comment

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

codecheck error

Suggested change
for (auto dep: dependencies)
for (auto dep : dependencies)

@@ -678,10 +700,19 @@ Result FuelClient::DownloadModel(const ModelIdentifier &_id,
if (!this->dataPtr->cache->SaveModel(newId, resp.data, true))
return Result(ResultType::FETCH_ERROR);

return this->ModelDependencies(_id, _dependencies);
Copy link
Contributor

Choose a reason for hiding this comment

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

codecheck error

Suggested change
return this->ModelDependencies(_id, _dependencies);
return this->ModelDependencies(_id, _dependencies);

@mjcarroll mjcarroll changed the base branch from ign-fuel-tools5 to ign-fuel-tools4 September 27, 2021 19:58
Signed-off-by: Michael Carroll <[email protected]>
@nkoenig
Copy link
Contributor

nkoenig commented Oct 1, 2021

Does this resolve #188 for you? I still see the errors when using a command like this:

ign fuel download -v 4 -j 8 --type model -u "https://fuel.ignitionrobotics.org/OpenRobotics/collections/SubT Tech Repo"

@nkoenig
Copy link
Contributor

nkoenig commented Oct 19, 2021

I'm getting similar errors seen in osrf/subt#943 when running

ign fuel download -v 4 -j 8 --type model -u "https://fuel.ignitionrobotics.org/OpenRobotics/collections/SubT Tech Repo"

such as

[Err] [Zip.cc:159] Error opening: materials/textures/Ground_Roughness.jpg
[Err] [Zip.cc:159] Error opening: materials/textures/Ground_Roughness.png
[Err] [Zip.cc:159] Error opening: materials/textures/Light_Albedo.jpg
[Err] [Zip.cc:159] Error opening: materials/textures/Light_Albedo.png
[Err] [Zip.cc:159] Error opening: materials/textures/Light_Emissive.jpg
[Err] [Zip.cc:159] Error opening: materials/textures/Light_Emissive.png
[Err] [Zip.cc:159] Error opening: materials/textures/Light_Metalness.jpg
[Err] [Zip.cc:159] Error opening: materials/textures/Light_Metalness.png
[Err] [Zip.cc:159] Error opening: materials/textures/Light_Normal.jpg

@mjcarroll mjcarroll marked this pull request as ready for review October 25, 2021 19:07
@mjcarroll
Copy link
Contributor Author

Updated the implementation to use threads rather than async which seems to avoid the segfaults I was seeing before.

@nkoenig
Copy link
Contributor

nkoenig commented Oct 29, 2021

I'm seeing compiler errors,

/FuelClient.cc:22:
/usr/include/c++/8/bits/unordered_set.h: In constructor ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(_InputIterator, _InputIterator, std::unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type, const hasher&, const key_equal&, const allocator_type&) [with _InputIterator = __gnu_cxx::__normal_iterator<const ignition::fuel_tools::ModelIdentifier*, std::vector<ignition::fuel_tools::ModelIdentifier> >; _Value = ignition::fuel_tools::ModelIdentifier; _Hash = std::hash<ignition::fuel_tools::ModelIdentifier>; _Pred = std::equal_to<ignition::fuel_tools::ModelIdentifier>; _Alloc = std::allocator<ignition::fuel_tools::ModelIdentifier>; std::unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type = long unsigned int; std::unordered_set<_Value, _Hash, _Pred, _Alloc>::hasher = std::hash<ignition::fuel_tools::ModelIdentifier>; std::unordered_set<_Value, _Hash, _Pred, _Alloc>::key_equal = std::equal_to<ignition::fuel_tools::ModelIdentifier>; std::unordered_set<_Value, _Hash, _Pred, _Alloc>::allocator_type = std::allocator<ignition::fuel_tools::ModelIdentifier>]’:
/usr/include/c++/8/bits/unordered_set.h:168:30: error: use of deleted function ‘std::hash<ignition::fuel_tools::ModelIdentifier>::hash()’
         const hasher& __hf = hasher(),

mjcarroll and others added 3 commits October 29, 2021 11:41
Signed-off-by: Nate Koenig <[email protected]>
Signed-off-by: Nate Koenig <[email protected]>
@nkoenig
Copy link
Contributor

nkoenig commented Oct 29, 2021

@mjcarroll , I think you were missing this line: d16d499? Can you confirm?

@codecov
Copy link

codecov bot commented Nov 4, 2021

Codecov Report

Merging #199 (a66b85f) into ign-fuel-tools4 (d078bd0) will decrease coverage by 0.20%.
The diff coverage is 81.19%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           ign-fuel-tools4     #199      +/-   ##
===================================================
- Coverage            78.13%   77.92%   -0.21%     
===================================================
  Files                   19       19              
  Lines                 2643     2718      +75     
===================================================
+ Hits                  2065     2118      +53     
- Misses                 578      600      +22     
Impacted Files Coverage Δ
src/FuelClient.cc 73.23% <80.35%> (+0.87%) ⬆️
src/ign.cc 57.74% <100.00%> (-3.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d078bd0...a66b85f. Read the comment docs.

@nkoenig nkoenig merged commit c680ee8 into ign-fuel-tools4 Nov 5, 2021
@nkoenig nkoenig deleted the parallel_downloads branch November 5, 2021 13:43
@scpeters scpeters mentioned this pull request Nov 6, 2021
7 tasks
@scpeters
Copy link
Member

scpeters commented Nov 6, 2021

fix for windows build in #213

auto result = client.DownloadWorlds(worldIds, _jobs);
ignerr << "Failed to download worlds for collection ["
<< collection.Name()
<< "]" << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

is this error message always printed even if the worlds are downloaded successfully?

scpeters added a commit that referenced this pull request Nov 7, 2021
This was introduced in #199.

Signed-off-by: Steve Peters <[email protected]>
mjcarroll pushed a commit that referenced this pull request Nov 8, 2021
* FuelClient.cc: include <deque>

Fixes the Windows build.

Signed-off-by: Steve Peters <[email protected]>

* ign_src_TEST: print error messages

Signed-off-by: Steve Peters <[email protected]>

* print one more error message

Signed-off-by: Steve Peters <[email protected]>

* ign.cc: remove console error message

This was introduced in #199.

Signed-off-by: Steve Peters <[email protected]>
@osrf-triage
Copy link

This pull request has been mentioned on Gazebo Community. There might be relevant details there:

https://community.gazebosim.org/t/new-ignition-releases-2022-01-10/1228/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔮 dome Ignition Dome
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants