Project

General

Profile

Développement #103095

disposer d'un outil "sysadmin" (manage) pour savoir ce que fait un job

Added by Thomas Noël 9 days ago. Updated 9 days ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07 March 2025
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

Quand un job est en cours on a dans les processus une ligne telle que

python3 /usr/lib/wcs/manage.py runjob --domain site.test.entrouvert.org --job-id 6dbb1451-cb75-43a1-8014-08f523cb1234

Il serait utile d'avoir une commande wcs-manage qui permette de savoir ce qui se cache derrière ce job 6dbb1451-cb75-43a1-8014-08f523cb1234

History

#1

Updated by Thomas Noël 9 days ago

Ça pourrait s'inspirer de ce script qu'on peut lancer avec « sudo -u wcs wcs-manage runscript --all-tenants list-jobs.py » :

from quixote import get_publisher
from wcs.qommon.afterjobs import AfterJob

tenant = get_publisher().tenant

for aj in AfterJob.select_iterator():
    print(f'{tenant.hostname}/{aj.id}')
    print(f'  status: {aj.status}')
    print(f'  failure_label: {aj.failure_label}')
    print(f'  creation_time: {aj.creation_time}')
    print(f'  completion_time: {aj.completion_time}')
    print(f'  current_count/total_count: {aj.current_count}/{aj.total_count}')
    print(f'  label: {aj.label}')
    if aj.execute:
        print(f'  execute: {aj.execute.__func__.__qualname__}')
    else:
        print(f'  job_cmd: {aj.job_cmd}')
    print(f'  kwargs: {aj.kwargs}')
    print()

et qui affiche chaque job avec ses détails, genre :

site.test.entrouvert.org/fb3e07c7-ef49-4692-aa27-250a85dd2dd8
  status: completed
  failure_label: None
  creation_time: 2025-03-07 15:53:11.309351+01:00
  completion_time: 2025-03-07 15:53:12.143050+01:00
  current_count/total_count: None/None
  label: None
  execute: TestsAfterJob.execute
  kwargs: {'objectdef_class': <class 'wcs.formdef.FormDef'>, 'objectdef_id': 525, 'reason': 'Modification du champ « Cadre règlementaire »', 'snapshot_id': 48780, 'triggered_by':
 ''}

Also available in: Atom PDF