Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #250 from joakim-hove/progress-api
Browse files Browse the repository at this point in the history
Progress api
  • Loading branch information
joakim-hove authored Mar 8, 2018
2 parents 3f214bb + 1368ec4 commit 6b6f88d
Show file tree
Hide file tree
Showing 20 changed files with 557 additions and 168 deletions.
1 change: 1 addition & 0 deletions libjob_queue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ endif ()
add_library(job_queue src/ext_job.c
src/ext_joblist.c
src/forward_model.c
src/job_status.c
src/job_list.c
src/job_node.c
src/job_queue.c
Expand Down
32 changes: 16 additions & 16 deletions libjob_queue/include/ert/job_queue/ext_job.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ext_job.h' is part of ERT - Ensemble based Reservoir Tool.
ERT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
for more details.
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ext_job.h' is part of ERT - Ensemble based Reservoir Tool.
ERT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/

#ifndef ERT_EXT_JOB_H
Expand Down Expand Up @@ -89,7 +89,7 @@ void ext_job_add_environment(ext_job_type *ext_job , const ch
void ext_job_clear_environment( ext_job_type * ext_job );
hash_type * ext_job_get_environment( ext_job_type * ext_job );
int ext_job_set_private_args_from_string( ext_job_type * ext_job , const char * arg_string );
const char * ext_job_get_private_args_as_string( ext_job_type * ext_job );
const char * ext_job_get_private_args_as_string( ext_job_type * ext_job );
const char * ext_job_get_license_path(const ext_job_type*);
//const char * ext_job_get_arglist_as_string( ext_job_type * ext_job );
//void ext_job_set_arglist_from_string( ext_job_type * ext_job , const char * argv_string );
Expand Down
140 changes: 140 additions & 0 deletions libjob_queue/include/ert/job_queue/job_status.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/*
Copyright (C) 2018 Statoil ASA, Norway.
The file 'job_status.h' is part of ERT - Ensemble based Reservoir Tool.
ERT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/

#ifndef JOB_STATUS_H
#define JOB_STATUS_H
#ifdef __cplusplus
extern "C" {
#endif

#include <ert/util/hash.h>
/*
+---------------------------------+
| |
+---------------------------------+ | JOB_QUEUE_WAITING <----------------------------------+
| | | <--------------+ |
| JOB_QUEUE_NOT_ACTIVE | +---------------+-----------------+ | |
| | | | |
+---------------------------------+ | | |
| | |
+---------------v-----------------+ | |
| | | |
+---------------------------------+ | JOB_QUEUE_SUBMITTED | | |
| | | | | |
|JOB_QUEUE_STATUS_FAILURE | +-------+--------------------+----+ | |
| | | | | |
+---------------------------------+ | | +----------------+----------------+ |
+-------------------------v-------+ | | | |
| | | | JOB_QUEUE_DO_KILL_NODE_FAILURE | |
| JOB_QUEUE_PENDING | | | | |
| | | +---------------------^-----------+ |
+-------------------------+-------+ | | |
| | | |
| +---------------v-----------------+ | |
| | | | |
+----> JOB_QUEUE_RUNNING +------+ |
+----------------------------------------------------------+ | |
| +---+-------------------+---------+ |
| | | |
| | | |
+--------------v------------------+ +---------------------------------+ | +---------v-----------------------+ |
| | | | | | | |
| JOB_QUEUE_DO_KILL | | JOB_QUEUE_DONE +<---+ +---> JOB_QUEUE_EXIT | |
| | | | | | | |
+--------------+------------------+ +----------------+----------------+ | +-----------------+---------------+ |
| | | | |
| | | | |
| | | | |
| +----------------v----------------+ | +-----------------v---------------+ |
| | | | | | |
| |JOB_QUEUE_RUNNING_DONE_CALLBACK +----------+ | JOB_QUEUE_RUNNING_EXIT_CALLBACK +-------+
| | | | |
| +----------------+----------------+ +----------------+----------------+
| | |
| | |
| | |
+--------------v------------------+ +----------------v----------------+ +----------------v----------------+
| | | | | |
| JOB_QUEUE_IS_KILLED | | JOB_QUEUE_SUCCESS | | JOB_QUEUE_FAILED |
| | | | | |
+---------------------------------+ +---------------------------------+ +---------------------------------+
*/



/*
NB: the status count algorithm has a HARD assumption that these
values are on the 2^N form - without holes in the series.
*/

typedef enum {
JOB_QUEUE_NOT_ACTIVE = 1, /* This value is used in external query routines - for jobs which are (currently) not active. */
JOB_QUEUE_WAITING = 2, /* A node which is waiting in the internal queue. */
JOB_QUEUE_SUBMITTED = 4, /* Internal status: It has has been submitted - the next status update will (should) place it as pending or running. */
JOB_QUEUE_PENDING = 8, /* A node which is pending - a status returned by the external system. I.e LSF */
JOB_QUEUE_RUNNING = 16, /* The job is running */
JOB_QUEUE_DONE = 32, /* The job is done - but we have not yet checked if the target file is produced */
JOB_QUEUE_EXIT = 64, /* The job has exited - check attempts to determine if we retry or go to complete_fail */
JOB_QUEUE_IS_KILLED = 128, /* The job has been killed, following a JOB_QUEUE_DO_KILL*/
JOB_QUEUE_DO_KILL = 256, /* The the job should be killed, either due to user request, or automated measures - the job can NOT be restarted. */
JOB_QUEUE_SUCCESS = 512,
JOB_QUEUE_RUNNING_DONE_CALLBACK = 1024,
JOB_QUEUE_RUNNING_EXIT_CALLBACK = 2048,
JOB_QUEUE_STATUS_FAILURE = 4096,
JOB_QUEUE_FAILED = 8192,
JOB_QUEUE_DO_KILL_NODE_FAILURE = 16384
} job_status_type;

#define JOB_QUEUE_RUNNING_CALLBACK (JOB_QUEUE_RUNNING_DONE_CALLBACK + JOB_QUEUE_RUNNING_EXIT_CALLBACK)

#define JOB_QUEUE_STATUS_ALL (JOB_QUEUE_NOT_ACTIVE + JOB_QUEUE_WAITING + JOB_QUEUE_SUBMITTED + JOB_QUEUE_PENDING + JOB_QUEUE_RUNNING + JOB_QUEUE_DONE + \
JOB_QUEUE_EXIT + JOB_QUEUE_IS_KILLED + JOB_QUEUE_DO_KILL + JOB_QUEUE_SUCCESS + JOB_QUEUE_RUNNING_CALLBACK + \
JOB_QUEUE_STATUS_FAILURE + JOB_QUEUE_FAILED + JOB_QUEUE_DO_KILL_NODE_FAILURE)

#define JOB_QUEUE_MAX_STATE 15

/*
All jobs which are in the status set defined by
JOB_QUEUE_CAN_RESTART can be restarted based on external
user-input. It is OK to try to restart a job which is not in this
state - basically nothing should happen.
*/
#define JOB_QUEUE_CAN_RESTART (JOB_QUEUE_FAILED + JOB_QUEUE_IS_KILLED + JOB_QUEUE_SUCCESS)


/*
These are the jobs which can be killed. It is OK to try to kill a
job which is not in this state, the only thing happening is that the
function job_queue_kill_simulation() wil return false.
*/
#define JOB_QUEUE_CAN_KILL (JOB_QUEUE_WAITING + JOB_QUEUE_RUNNING + JOB_QUEUE_PENDING + JOB_QUEUE_SUBMITTED + JOB_QUEUE_DO_KILL + JOB_QUEUE_DO_KILL_NODE_FAILURE)

#define JOB_QUEUE_WAITING_STATUS (JOB_QUEUE_WAITING + JOB_QUEUE_PENDING)

#define JOB_QUEUE_CAN_UPDATE_STATUS (JOB_QUEUE_RUNNING + JOB_QUEUE_PENDING + JOB_QUEUE_SUBMITTED)

#define JOB_QUEUE_COMPLETE_STATUS (JOB_QUEUE_IS_KILLED + JOB_QUEUE_SUCCESS + JOB_QUEUE_FAILED)


const char * job_status_get_name(job_status_type status);

#ifdef __cplusplus
}
#endif
#endif
Loading

0 comments on commit 6b6f88d

Please sign in to comment.