-
Notifications
You must be signed in to change notification settings - Fork 47
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
Conversation
70138a4
to
ebce8cb
Compare
Fantastic PR! I will have a look at it tomorrow. |
9d972dc
to
7f33c39
Compare
* 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
brayns/Brayns.cpp
Outdated
@@ -580,12 +584,13 @@ struct Brayns::Impl : public PluginAPI | |||
Vector3f(volumeDimensions) * | |||
volumeElementSpacing); | |||
} | |||
return 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.
I think it always returns true, so is this needed..?
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 anymore
brayns/common/Progress.h
Outdated
* 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. |
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.
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; |
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.
That was random indeed without the breaks... rand() % 4 still generates cases 0-3 and there are only cases 0-2...
brayns/common/tasks/Task.h
Outdated
|
||
/** | ||
* Cancels the task if is either waiting to be scheduled or already running. | ||
* Will have no effect if the task already finished. |
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.
maybe there should be a guard to enforce that, right now virtual _cancel() is always called so that's not necessarily the case
brayns/common/tasks/Task.h
Outdated
Progress& getProgress() { return _progress; } | ||
protected: | ||
async::cancellation_token _cancelToken; | ||
Progress _progress{"Scheduling task ..."}; |
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.
could almost be public, it has a non-const getter already
brayns/tasks/UploadBinaryTask.cpp
Outdated
if (params.empty()) | ||
throw MISSING_PARAMS; | ||
|
||
// pre-check for validity of given params |
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.
make it a function, this ctor is too long.
brayns/tasks/UploadPathTask.h
Outdated
* A task which loads data from a list of paths and adds the loaded data to the | ||
* scene. | ||
*/ | ||
class UploadPathTask : public TaskT<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.
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?
brayns/tasks/errors.h
Outdated
|
||
const auto& error() const { return _error; } | ||
private: | ||
const BinaryError _error; |
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.
could be public
brayns/tasks/UploadPathTask.h
Outdated
std::vector<async::task<void>> _loadTasks; | ||
}; | ||
|
||
auto createUploadPathTask(std::vector<std::string>&& paths, const uintptr_t, |
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 don't really see the point of this strange method here.
try | ||
{ | ||
// transform task result to rockets response | ||
auto readyCallback = [respond](R result) { |
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.
const R&
No description provided.