Skip to content

Commit cb7ae61

Browse files
committed
libjob: support virtual states in conversions
Problem: It would be convenient if virtual job states of "pending", "running", and "active" could be parsed and handled by flux_job_statetostr() and flux_job_strtostate(). Solution: Add virtual states to the table of states that can be parsed and handled by flux_job_statetostr() and flux_job_strtostate(). Update unit tests for coverage as well.
1 parent cebabb1 commit cb7ae61

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/common/libjob/state.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ static struct strtab states[] = {
2626
{ FLUX_JOB_STATE_RUN, "RUN", "run", "R", "r" },
2727
{ FLUX_JOB_STATE_CLEANUP, "CLEANUP", "cleanup", "C", "c" },
2828
{ FLUX_JOB_STATE_INACTIVE, "INACTIVE", "inactive", "I", "i" },
29+
{ FLUX_JOB_STATE_PENDING, "PENDING", "pending", "PE", "pe" },
30+
{ FLUX_JOB_STATE_RUNNING, "RUNNING", "running", "RU", "ru" },
31+
{ FLUX_JOB_STATE_ACTIVE, "ACTIVE", "active", "AC", "ac" },
2932
};
3033

3134

src/common/libjob/test/job.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ struct ss sstab[] = {
241241
{ FLUX_JOB_STATE_RUN, "R", "RUN", "r", "run" },
242242
{ FLUX_JOB_STATE_CLEANUP, "C", "CLEANUP", "c", "cleanup" },
243243
{ FLUX_JOB_STATE_INACTIVE, "I", "INACTIVE", "i", "inactive" },
244+
{ FLUX_JOB_STATE_PENDING, "PE", "PENDING", "pe", "pending" },
245+
{ FLUX_JOB_STATE_RUNNING, "RU", "RUNNING", "ru", "running" },
246+
{ FLUX_JOB_STATE_ACTIVE, "AC", "ACTIVE", "ac", "active" },
244247
{ -1, NULL, NULL, NULL, NULL },
245248
};
246249

0 commit comments

Comments
 (0)