2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 10:05:39 +00:00

Tasks API Endpoint (#6230)

* Add API endpoint for background task overview

* Cleanup other pending heartbeat tasks

* Adds API endpoint for queued tasks

* Adds API endpoint for scheduled tasks

* Add API endpoint for failed tasks

* Update API version info

* Add table for displaying pending tasks

* Add failed tasks table

* Use accordion

* Annotate extra data to scheduled tasks serializer

* Extend API functionality

* Update tasks.py

- Allow skipping of static file step in "invoke update"
- Allows for quicker updates in dev mode

* Display task result error for failed tasks

* Allow delete of failed tasks

* Remove old debug message

* Adds ability to delete pending tasks

* Update table columns

* Fix unused imports

* Prevent multiple heartbeat functions from being added to the queue at startup

* Add unit tests for API
This commit is contained in:
Oliver
2024-01-17 07:10:42 +11:00
committed by GitHub
parent 5c7d3af150
commit 75f75ed820
18 changed files with 569 additions and 15 deletions

View File

@ -376,14 +376,21 @@ def migrate(c):
@task(
post=[static, clean_settings, translate_stats],
post=[clean_settings, translate_stats],
help={
'skip_backup': 'Skip database backup step (advanced users)',
'frontend': 'Force frontend compilation/download step (ignores INVENTREE_DOCKER)',
'no_frontend': 'Skip frontend compilation/download step',
'skip_static': 'Skip static file collection step',
},
)
def update(c, skip_backup=False, frontend: bool = False, no_frontend: bool = False):
def update(
c,
skip_backup: bool = False,
frontend: bool = False,
no_frontend: bool = False,
skip_static: bool = False,
):
"""Update InvenTree installation.
This command should be invoked after source code has been updated,
@ -394,8 +401,8 @@ def update(c, skip_backup=False, frontend: bool = False, no_frontend: bool = Fal
- install
- backup (optional)
- migrate
- frontend_compile or frontend_download
- static
- frontend_compile or frontend_download (optional)
- static (optional)
- clean_settings
- translate_stats
"""
@ -421,6 +428,9 @@ def update(c, skip_backup=False, frontend: bool = False, no_frontend: bool = Fal
else:
frontend_download(c)
if not skip_static:
static(c)
# Data tasks
@task(