Skip to content

Conversation

@jjmerchante
Copy link
Contributor

@jjmerchante jjmerchante commented Nov 11, 2025

This PR includes SortingHat tasks using GrimoireLab scheduler. This allows to run the jobs from SortingHat, such as affiliate, unify, genderize, and import identities and generate recommendations.

Include new API endpoints to list, create, retrieve, reschedule, and cancel tasks:

/api/v1/<str:task_type>/<str:uuid>/
/api/v1/<str:task_type>/<str:uuid>/reschedule/
/api/v1/<str:task_type>/<str:uuid>/cancel/
/api/v1/<str:task_type>/<str:task_id>/jobs/
/api/v1/<str:task_type>/<str:task_id>/jobs/<str:uuid>/
/api/v1/<str:task_type>/<str:task_id>/jobs/<str:uuid>/logs

Currently, task_type could be eventizer or sortinghat.

The API and serializers have been rewritten and simplified to be the same for all the tasks because they share most of the functionality. Each task includes its own extra fields to the generic task serialiazers.

Fixes chaoss/grimoirelab#798

If a task fails to create a job for any reason, it will
not be executed. Ensure that every task has a related job.

Signed-off-by: Jose Javier Merchante <jjmerchante@bitergia.com>
This commit includes SortingHat tasks using GrimoireLab
scheduler. This allows to run the jobs from SortingHat,
such as affiliate, unify, genderize, and import identities
and generate recommendations.

Include new API endpoints to list, create, retrieve,
reschedule, and cancel tasks:

```
/api/v1/<str:task_type>/<str:uuid>/
/api/v1/<str:task_type>/<str:uuid>/reschedule/
/api/v1/<str:task_type>/<str:uuid>/cancel/
/api/v1/<str:task_type>/<str:task_id>/jobs/
/api/v1/<str:task_type>/<str:task_id>/jobs/<str:uuid>/
/api/v1/<str:task_type>/<str:task_id>/jobs/<str:uuid>/logs
```

Currently, task_type could be eventizer or sortinghat.

Signed-off-by: Jose Javier Merchante <jjmerchante@bitergia.com>
@jjmerchante
Copy link
Contributor Author

Jobs can still be scheduled using the GraphQL API, but there won’t be any worker to process them. We may need a way to disable this in the settings.

task = schedule_task(**serializer.create_scheduler_task_args())
except Exception as e:
return response.Response(
{"detail": f"Error scheduling task: {str(e)}"},

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
@jjmerchante jjmerchante changed the title Sortinghat jobs Schedule Sortinghat jobs using GrimoireLab core scheduler Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use grimoirelab-core scheduler for scheduling SortingHat jobs

1 participant