-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(TaskProcessingApi): Add endpoint for getting the next task #45391
base: master
Are you sure you want to change the base?
Conversation
Ah, I missed this, yes.
Yeah, let's do this manually directly in the endpoint |
5800675
to
6d86511
Compare
We need endpoint for getting nextTask by specifying multiple task_types. Or just to change |
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 agree with @marcelklehr that it makes more sense to change the task status to "running" in the controller method.
TheManager::getNextScheduledTask
method might be used in some context where we don't want to change to task status. -
Also, how about having a
setTaskRunning
parameter (withtrue
as default value) inTaskProcessingApiController::getNextScheduledTask
? Just in case one wants to get the next scheduled task without actually processing it. -
About requesting multiple task types in
getNextScheduledTask
, much needed indeed. @marcelklehr Would you go with another endpoint or change the current one?
I don't see a reason why you would ever need to know the next task without also running it at the same time, but I can change it if you really want 🤷♀️ |
The synchronous background job will re-schedule itself based on the fact whether there is another job waiting to be executed. |
We can add this to the current endpoint. |
// TODO: Fetch provider name from DB | ||
'name' => 'llm2:tinyllama-1.1b-chat-v1.0.Q4_0:summary', |
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.
The only remaining part that needs to be implemented. Waiting on an answer from @marcelklehr
711a3fe
to
7e6e94a
Compare
*/ | ||
#[NoAdminRequired] | ||
#[ApiRoute(verb: 'GET', url: '/tasks/next', root: '/taskprocessing')] | ||
public function getNextScheduledTask(array $taskTypeIds): DataResponse { |
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.
this method is callable for any user and it will freely give out any scheduled tasks of other users.
Signed-off-by: provokateurin <kate@provokateurin.de>
Signed-off-by: provokateurin <kate@provokateurin.de>
7e6e94a
to
8063ff5
Compare
@@ -191,6 +194,10 @@ public function beforeController($controller, $methodName) { | |||
} | |||
} | |||
|
|||
if ($this->hasAnnotationOrAttribute($reflectionMethod, 'ExAppRequired', ExAppRequired::class) && (!$this->userSession instanceof Session || $this->userSession->getSession()->get('app_api') !== 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.
Could also not introduce the annotation (and then simply directly only check for the attribute)
Summary
The ExApps need a way to get the next task.
@marcelklehr I think there is a bug as the tasks are not marked as running when the getNextScheduledTask method of the service is called (or maybe it was also intentional and the endpoint should do it manually).
Checklist