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

Batch tasks submitted to dispatcher in reverse order #484

Closed
Yadunund opened this issue Aug 30, 2021 · 5 comments
Closed

Batch tasks submitted to dispatcher in reverse order #484

Yadunund opened this issue Aug 30, 2021 · 5 comments

Comments

@Yadunund
Copy link
Member

It seems that when a batch task file containing tasks [A, B, C] is uploaded, the dashboard submits the tasks to the dispatcher in the reverse sequence, ie, C->B->A. This causes minor inconvenience with scripting scenarios for demos.

@Yadunund Yadunund added the bug Something isn't working label Aug 30, 2021
@koonpeng
Copy link
Collaborator

  const submitTasks = React.useCallback<Required<TaskPanelProps>['submitTasks']>(
    async (tasks) => {
      if (!tasksApi) {
        throw new Error('tasks api not available');
      }
      await Promise.all(tasks.map((t) => tasksApi.submitTaskTasksSubmitTaskPost(t)));
      handleRefresh();
    },
    [tasksApi, handleRefresh],
  );

Since rmf does not support batch tasks, the client is submitting the requests in parallel, the order is probably a byproduct of how the browser handles scheduling of promises. If we want to change this behavior, we will have to submit tasks in sequence which will slow down the process.

@koonpeng koonpeng added discussion and removed bug Something isn't working labels Aug 31, 2021
@Yadunund
Copy link
Member Author

Ah I see. Thanks for explaining why this happens. Is it safe to say that the behaviour is also browser specific, ie, the same file uploaded via dashboards running on Firefox and Chrome may have different outcomes? If so we will make sure to use the same browser to upload th scenario for the demo.

@koonpeng
Copy link
Collaborator

koonpeng commented Sep 2, 2021

Currently batch upload is unordered, so we can assume the order may be different everytime. Because we are uploading tasks in parallel, external factors like network latency may change the order as well.

@koonpeng
Copy link
Collaborator

koonpeng commented Sep 8, 2021

I believe this is only fixed on the throwaway branch, it remains a question if we should port it to the main branch, use the current parallel impl or wait for open-rmf/rmf_ros2#115 to be implemented first and use actual batch task submissions rather than hacking around it on the client side.

@koonpeng koonpeng reopened this Sep 8, 2021
@aaronchongth
Copy link
Member

This can be achieved using the task scheduler now

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

No branches or pull requests

4 participants