diff --git a/src/DIRAC/WorkloadManagementSystem/Client/JobStatus.py b/src/DIRAC/WorkloadManagementSystem/Client/JobStatus.py index 125075e3048..f8c912cda2a 100644 --- a/src/DIRAC/WorkloadManagementSystem/Client/JobStatus.py +++ b/src/DIRAC/WorkloadManagementSystem/Client/JobStatus.py @@ -88,7 +88,7 @@ def __init__(self, state): RUNNING: State(8, [STALLED, DONE, FAILED, RESCHEDULED, COMPLETING, KILLED, RECEIVED], defState=RUNNING), RESCHEDULED: State(7, [WAITING, RECEIVED, DELETED, FAILED], defState=RESCHEDULED), MATCHED: State(6, [RUNNING, FAILED, RESCHEDULED, KILLED], defState=MATCHED), - WAITING: State(5, [MATCHED, RESCHEDULED, DELETED], defState=WAITING), + WAITING: State(5, [MATCHED, RESCHEDULED, DELETED, KILLED], defState=WAITING), STAGING: State(4, [CHECKING, WAITING, FAILED, KILLED], defState=STAGING), SCOUTING: State(3, [CHECKING, FAILED, STALLED, KILLED], defState=SCOUTING), CHECKING: State(2, [SCOUTING, STAGING, WAITING, RESCHEDULED, FAILED, DELETED], defState=CHECKING), diff --git a/tests/Integration/WorkloadManagementSystem/Test_JobDB.py b/tests/Integration/WorkloadManagementSystem/Test_JobDB.py index 7945c020aeb..6ea741eb592 100644 --- a/tests/Integration/WorkloadManagementSystem/Test_JobDB.py +++ b/tests/Integration/WorkloadManagementSystem/Test_JobDB.py @@ -8,15 +8,14 @@ from datetime import datetime, timedelta from unittest.mock import MagicMock, patch -import pytest import DIRAC +import pytest DIRAC.initialize() # Initialize configuration -from DIRAC import gLogger, S_OK -from DIRAC.WorkloadManagementSystem.Client import JobStatus -from DIRAC.WorkloadManagementSystem.Client import JobMinorStatus +from DIRAC import S_OK, gLogger +from DIRAC.WorkloadManagementSystem.Client import JobMinorStatus, JobStatus # sut from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB @@ -317,14 +316,20 @@ def test_setJobsMajorStatus(jobDB): assert res["OK"] is True, res["Message"] res = jobDB.getJobsAttributes([jobID_1, jobID_2], ["Status"]) assert res["OK"] is True, res["Message"] - assert res["Value"] == {jobID_1: {"Status": JobStatus.WAITING}, jobID_2: {"Status": JobStatus.CHECKING}} + assert res["Value"] == {jobID_1: {"Status": JobStatus.KILLED}, jobID_2: {"Status": JobStatus.CHECKING}} - res = jobDB.setJobsMajorStatus([jobID_1], JobStatus.KILLED, force=True) + res = jobDB.setJobsMajorStatus([jobID_1], JobStatus.RUNNING) assert res["OK"] is True, res["Message"] res = jobDB.getJobsAttributes([jobID_1, jobID_2], ["Status"]) assert res["OK"] is True, res["Message"] assert res["Value"] == {jobID_1: {"Status": JobStatus.KILLED}, jobID_2: {"Status": JobStatus.CHECKING}} + res = jobDB.setJobsMajorStatus([jobID_1], JobStatus.RUNNING, force=True) + assert res["OK"] is True, res["Message"] + res = jobDB.getJobsAttributes([jobID_1, jobID_2], ["Status"]) + assert res["OK"] is True, res["Message"] + assert res["Value"] == {jobID_1: {"Status": JobStatus.RUNNING}, jobID_2: {"Status": JobStatus.CHECKING}} + def test_attributes(jobDB): res = jobDB.insertNewJobIntoDB(jdl, "owner_1", "/DN/OF/owner", "ownerGroup", "someSetup")