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

Resolve #368: RPC for data receive and load #374

Merged
merged 2 commits into from
Apr 30, 2018

Conversation

tribal-tec
Copy link
Contributor

No description provided.

@tribal-tec tribal-tec force-pushed the master branch 3 times, most recently from 70138a4 to ebce8cb Compare April 19, 2018 15:18
@tribal-tec tribal-tec requested review from rdumusc and favreau April 19, 2018 15:22
@favreau
Copy link
Member

favreau commented Apr 19, 2018

Fantastic PR! I will have a look at it tomorrow.

@tribal-tec tribal-tec force-pushed the master branch 3 times, most recently from 9d972dc to 7f33c39 Compare April 20, 2018 13:24
* Use async++ for generic async tasks with cancel and progress support
* New tasks for upload-binary and upload-path RPCs
* LoadDataFunctor used by upload tasks for loading meshes and xyz at the moment
* Transformed snapshot to async task
* Progress updates to client only via RPCs using Rockets
@@ -580,12 +584,13 @@ struct Brayns::Impl : public PluginAPI
Vector3f(volumeDimensions) *
volumeElementSpacing);
}
return true;
Copy link

Choose a reason for hiding this comment

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

I think it always returns true, so is this needed..?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not anymore

* case, only the first OpenMP thread reports progress, but still tracks from
* all threads.
* A progress object which offers thread-safe progress updates and thread-safe
* consumation of the current progress if it has changed in between.
Copy link

Choose a reason for hiding this comment

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

consumation is probably not the right word

case 2:
// Reflector
material.setReflectionIndex(float(std::rand() % 100) / 100.f);
material.setSpecularColor(Vector3f(0.01f, 0.01f, 0.01f));
material.setSpecularExponent(10.f);
break;
Copy link

Choose a reason for hiding this comment

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

That was random indeed without the breaks... rand() % 4 still generates cases 0-3 and there are only cases 0-2...


/**
* Cancels the task if is either waiting to be scheduled or already running.
* Will have no effect if the task already finished.
Copy link

Choose a reason for hiding this comment

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

maybe there should be a guard to enforce that, right now virtual _cancel() is always called so that's not necessarily the case

Progress& getProgress() { return _progress; }
protected:
async::cancellation_token _cancelToken;
Progress _progress{"Scheduling task ..."};
Copy link

Choose a reason for hiding this comment

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

could almost be public, it has a non-const getter already

if (params.empty())
throw MISSING_PARAMS;

// pre-check for validity of given params
Copy link

Choose a reason for hiding this comment

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

make it a function, this ctor is too long.

* A task which loads data from a list of paths and adds the loaded data to the
* scene.
*/
class UploadPathTask : public TaskT<bool>
Copy link

Choose a reason for hiding this comment

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

I'm realizing now that TaskT is a strange class name, by convention this generally denotes a typename in a template. How about renaming TaskT -> Task and Task -> AbstractTask?


const auto& error() const { return _error; }
private:
const BinaryError _error;
Copy link

Choose a reason for hiding this comment

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

could be public

std::vector<async::task<void>> _loadTasks;
};

auto createUploadPathTask(std::vector<std::string>&& paths, const uintptr_t,
Copy link

Choose a reason for hiding this comment

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

I don't really see the point of this strange method here.

try
{
// transform task result to rockets response
auto readyCallback = [respond](R result) {
Copy link

Choose a reason for hiding this comment

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

const R&

@tribal-tec tribal-tec merged commit 7192c89 into BlueBrain:master Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants