How to use the ert.job_queue.QueuePrototype function in ert

To help you get started, we’ve selected a few ert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OPM / ResInsight / ThirdParty / Ert / python / python / ert / job_queue / ext_job.py View on Github external
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or 
#  FITNESS FOR A PARTICULAR PURPOSE.   
#   
#  See the GNU General Public License at  
#  for more details.
import os.path

from cwrap import BaseCClass
from ert.job_queue import QueuePrototype


class ExtJob(BaseCClass):
    TYPE_NAME                   = "ext_job"
    _alloc                      = QueuePrototype("void* ext_job_alloc(char*, char*, int)", bind = False)
    _fscanf_alloc               = QueuePrototype("void* ext_job_fscanf_alloc(char*, char*, bool, char* , bool)", bind = False)
    _free                       = QueuePrototype("void ext_job_free( ext_job )")
    _get_help_text              = QueuePrototype("char* ext_job_get_help_text(ext_job)")
    _get_name                   = QueuePrototype("char* ext_job_get_name(ext_job)")
    _get_private_args_as_string = QueuePrototype("char* ext_job_get_private_args_as_string(ext_job)")
    _set_private_args_as_string = QueuePrototype("void ext_job_set_private_args_from_string(ext_job, char*)")
    _is_private                 = QueuePrototype("int ext_job_is_private(ext_job)")
    _get_config_file            = QueuePrototype("char* ext_job_get_config_file(ext_job)")
    _set_config_file            = QueuePrototype("void ext_job_set_config_file(ext_job, char*)")
    _get_stdin_file             = QueuePrototype("char* ext_job_get_stdin_file(ext_job)")
    _set_stdin_file             = QueuePrototype("void ext_job_set_stdin_file(ext_job, char*)")
    _get_stdout_file            = QueuePrototype("char* ext_job_get_stdout_file(ext_job)")
    _set_stdout_file            = QueuePrototype("void ext_job_set_stdout_file(ext_job, char*)")
    _get_stderr_file            = QueuePrototype("char* ext_job_get_stderr_file(ext_job)")
    _set_stderr_file            = QueuePrototype("void ext_job_set_stderr_file(ext_job, char*)")
    _get_target_file            = QueuePrototype("char* ext_job_get_target_file(ext_job)")
    _set_target_file            = QueuePrototype("void ext_job_set_target_file(ext_job, char*)")
    _get_executable             = QueuePrototype("char* ext_job_get_executable(ext_job)")
github Ensembles / ert / python / python / ert / job_queue / workflow_joblist.py View on Github external
import os
from cwrap import BaseCClass
from ert.job_queue import QueuePrototype, WorkflowJob


class WorkflowJoblist(BaseCClass):
    TYPE_NAME = "workflow_joblist"
    _alloc              = QueuePrototype("void*            workflow_joblist_alloc()" , bind = False)
    _free               = QueuePrototype("void             workflow_joblist_free(workflow_joblist)")
    _add_job            = QueuePrototype("void             workflow_joblist_add_job(workflow_joblist, workflow_job)")
    _add_job_from_file  = QueuePrototype("bool             workflow_joblist_add_job_from_file(workflow_joblist, char*, char*)")
    _has_job            = QueuePrototype("bool             workflow_joblist_has_job(workflow_joblist, char*)")
    _get_job            = QueuePrototype("workflow_job_ref workflow_joblist_get_job(workflow_joblist, char*)")
    _count              = QueuePrototype("workflow_job_ref workflow_joblist_get_job(workflow_joblist, char*)")

    def __init__(self):
        c_ptr = self._alloc( )
        super(WorkflowJoblist, self).__init__(c_ptr)


    def addJob(self, job):
        """ @type job: WorkflowJob """
        job.convertToCReference(self)
        self._add_job(job)
github Ensembles / ert / devel / python / python / ert / job_queue / job_queue_manager.py View on Github external
#   
#  See the GNU General Public License at  
#  for more details. 
"""
Module implementing a queue for managing external jobs.

"""
from ert.cwrap import BaseCClass, CWrapper
from ert.job_queue import QueuePrototype, Job, JobStatusType

class JobQueueManager(BaseCClass):
    TYPE_NAME = "job_queue_manager"
    _alloc           = QueuePrototype("void* job_queue_manager_alloc( job_queue)", bind = False)
    _free            = QueuePrototype("void job_queue_manager_free( job_queue_manager )")
    _start_queue     = QueuePrototype("void job_queue_manager_start_queue( job_queue_manager , int , bool, bool)")
    _get_num_waiting = QueuePrototype("int job_queue_manager_get_num_waiting( job_queue_manager )")
    _get_num_running = QueuePrototype("int job_queue_manager_get_num_running( job_queue_manager )")
    _get_num_success = QueuePrototype("int job_queue_manager_get_num_success( job_queue_manager )")
    _get_num_failed  = QueuePrototype("int job_queue_manager_get_num_failed( job_queue_manager )")
    _is_running      = QueuePrototype("bool job_queue_manager_is_running( job_queue_manager )")
    _job_complete    = QueuePrototype("bool job_queue_manager_job_complete( job_queue_manager , int)")
    _job_running     = QueuePrototype("bool job_queue_manager_job_running( job_queue_manager , int)")
    _job_failed      = QueuePrototype("bool job_queue_manager_job_failed( job_queue_manager , int)")
    _job_waiting     = QueuePrototype("bool job_queue_manager_job_waiting( job_queue_manager , int)")
    _job_success     = QueuePrototype("bool job_queue_manager_job_success( job_queue_manager , int)")

    # The return type of the job_queue_manager_iget_job_status should
    # really be the enum job_status_type_enum, but I just did not
    # manage to get the prototyping right. Have therefor taken the
    # return as an integer and convert it in the getJobStatus()
    # method.
    _job_status      = QueuePrototype("int job_queue_manager_iget_job_status(job_queue_manager, int)")
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / job_queue / driver.py View on Github external
QueueDriverEnum.addEnum( "TORQUE_DRIVER" , 4 )
QueueDriverEnum.registerEnum(JOB_QUEUE_LIB, "queue_driver_enum")    


LSF_DRIVER   = QueueDriverEnum.LSF_DRIVER
RSH_DRIVER   = QueueDriverEnum.RSH_DRIVER
LOCAL_DRIVER = QueueDriverEnum.LOCAL_DRIVER



class Driver(BaseCClass):
    TYPE_NAME = "driver"
    _alloc = QueuePrototype("void* queue_driver_alloc( queue_driver_enum )" , bind = False)
    _free = QueuePrototype("void queue_driver_free( driver )")
    _set_option = QueuePrototype("void queue_driver_set_option( driver , char* , char*)")
    _submit = QueuePrototype("void* queue_driver_submit_job( driver , char* , int , char* , char* , int , char**)")
    _free_job = QueuePrototype("void   queue_driver_free_job( driver , job )")
    _get_status = QueuePrototype("int queue_driver_get_status( driver , job)")
    _kill_job = QueuePrototype("void queue_driver_kill_job( driver , job )")
    _get_max_running = QueuePrototype("int queue_driver_get_max_running( driver )")
    _set_max_running = QueuePrototype("void queue_driver_set_max_running( driver , int)")
    _get_name = QueuePrototype("char* queue_driver_get_name( driver )")
    
    def __init__( self, driver_type, max_running=1, options=None):
        """
        Creates a new driver instance
        """
        c_ptr = self._alloc( driver_type )
        super(Driver , self).__init__(c_ptr)
        if options:
            for (key, value) in options:
                self.set_option(key, value)
github Ensembles / ert / devel / python / python / ert / job_queue / job_queue_manager.py View on Github external
_get_num_running = QueuePrototype("int job_queue_manager_get_num_running( job_queue_manager )")
    _get_num_success = QueuePrototype("int job_queue_manager_get_num_success( job_queue_manager )")
    _get_num_failed  = QueuePrototype("int job_queue_manager_get_num_failed( job_queue_manager )")
    _is_running      = QueuePrototype("bool job_queue_manager_is_running( job_queue_manager )")
    _job_complete    = QueuePrototype("bool job_queue_manager_job_complete( job_queue_manager , int)")
    _job_running     = QueuePrototype("bool job_queue_manager_job_running( job_queue_manager , int)")
    _job_failed      = QueuePrototype("bool job_queue_manager_job_failed( job_queue_manager , int)")
    _job_waiting     = QueuePrototype("bool job_queue_manager_job_waiting( job_queue_manager , int)")
    _job_success     = QueuePrototype("bool job_queue_manager_job_success( job_queue_manager , int)")

    # The return type of the job_queue_manager_iget_job_status should
    # really be the enum job_status_type_enum, but I just did not
    # manage to get the prototyping right. Have therefor taken the
    # return as an integer and convert it in the getJobStatus()
    # method.
    _job_status      = QueuePrototype("int job_queue_manager_iget_job_status(job_queue_manager, int)")

    def __init__(self, queue):
        c_ptr = self._alloc(queue)
        super(JobQueueManager, self).__init__(c_ptr)


    def startQueue(self , total_size , verbose = False , reset_queue = True):
        self._start_queue( total_size , verbose , reset_queue)

    def getNumRunning(self):
        return self._get_num_running(  )

    def getNumWaiting(self):
        return self._get_num_waiting( )

    def getNumSuccess(self):
github Ensembles / ert / devel / python / python / ert / job_queue / workflow_joblist.py View on Github external
import os
from ert.cwrap import BaseCClass
from ert.job_queue import QueuePrototype, WorkflowJob


class WorkflowJoblist(BaseCClass):
    TYPE_NAME = "workflow_joblist"
    _alloc              = QueuePrototype("void*            workflow_joblist_alloc()" , bind = False)
    _free               = QueuePrototype("void             workflow_joblist_free(workflow_joblist)")
    _add_job            = QueuePrototype("void             workflow_joblist_add_job(workflow_joblist, workflow_job)")
    _add_job_from_file  = QueuePrototype("bool             workflow_joblist_add_job_from_file(workflow_joblist, char*, char*)")
    _has_job            = QueuePrototype("bool             workflow_joblist_has_job(workflow_joblist, char*)")
    _get_job            = QueuePrototype("workflow_job_ref workflow_joblist_get_job(workflow_joblist, char*)")
    _count              = QueuePrototype("workflow_job_ref workflow_joblist_get_job(workflow_joblist, char*)")

    def __init__(self):
        c_ptr = self._alloc( )
        super(WorkflowJoblist, self).__init__(c_ptr)


    def addJob(self, job):
        """ @type job: WorkflowJob """
        job.convertToCReference(self)
        self._add_job(job)

        
    def addJobFromFile(self, name, filepath):
        """
         @type name: str
github Ensembles / ert / devel / python / python / ert / job_queue / ext_joblist.py View on Github external
#  (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  
#  for more details.
from ert.cwrap import CWrapper, BaseCClass
from ert.job_queue import QueuePrototype, ExtJob
from ert.util import StringList


class ExtJoblist(BaseCClass):
    TYPE_NAME = "ext_joblist"
    _free       = QueuePrototype("void ext_joblist_free( ext_joblist )")
    _alloc_list = QueuePrototype("stringlist_ref ext_joblist_alloc_list(ext_joblist)")
    _get_job    = QueuePrototype("ext_job_ref ext_joblist_get_job(ext_joblist, char*)")
    _del_job    = QueuePrototype("int ext_joblist_del_job(ext_joblist, char*)")
    _has_job    = QueuePrototype("int ext_joblist_has_job(ext_joblist, char*)")
    _add_job    = QueuePrototype("void ext_joblist_add_job(ext_joblist, char*, ext_joblist)")
    _get_jobs   = QueuePrototype("hash_ref ext_joblist_get_jobs(ext_joblist)")

    def __init__(self):
        raise NotImplementedError("Class can not be instantiated directly!")

    def get_jobs(self):
        """ @rtype: Hash """
        jobs = self._get_jobs( )
        jobs.setParent(self)
        return jobs
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / job_queue / driver.py View on Github external
RSH_DRIVER   = QueueDriverEnum.RSH_DRIVER
LOCAL_DRIVER = QueueDriverEnum.LOCAL_DRIVER



class Driver(BaseCClass):
    TYPE_NAME = "driver"
    _alloc = QueuePrototype("void* queue_driver_alloc( queue_driver_enum )" , bind = False)
    _free = QueuePrototype("void queue_driver_free( driver )")
    _set_option = QueuePrototype("void queue_driver_set_option( driver , char* , char*)")
    _submit = QueuePrototype("void* queue_driver_submit_job( driver , char* , int , char* , char* , int , char**)")
    _free_job = QueuePrototype("void   queue_driver_free_job( driver , job )")
    _get_status = QueuePrototype("int queue_driver_get_status( driver , job)")
    _kill_job = QueuePrototype("void queue_driver_kill_job( driver , job )")
    _get_max_running = QueuePrototype("int queue_driver_get_max_running( driver )")
    _set_max_running = QueuePrototype("void queue_driver_set_max_running( driver , int)")
    _get_name = QueuePrototype("char* queue_driver_get_name( driver )")
    
    def __init__( self, driver_type, max_running=1, options=None):
        """
        Creates a new driver instance
        """
        c_ptr = self._alloc( driver_type )
        super(Driver , self).__init__(c_ptr)
        if options:
            for (key, value) in options:
                self.set_option(key, value)
        self.set_max_running(max_running)


    def set_option(self, option, value):
        """
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / job_queue / ext_job.py View on Github external
_get_name                   = QueuePrototype("char* ext_job_get_name(ext_job)")
    _get_private_args_as_string = QueuePrototype("char* ext_job_get_private_args_as_string(ext_job)")
    _set_private_args_as_string = QueuePrototype("void ext_job_set_private_args_from_string(ext_job, char*)")
    _is_private                 = QueuePrototype("int ext_job_is_private(ext_job)")
    _get_config_file            = QueuePrototype("char* ext_job_get_config_file(ext_job)")
    _set_config_file            = QueuePrototype("void ext_job_set_config_file(ext_job, char*)")
    _get_stdin_file             = QueuePrototype("char* ext_job_get_stdin_file(ext_job)")
    _set_stdin_file             = QueuePrototype("void ext_job_set_stdin_file(ext_job, char*)")
    _get_stdout_file            = QueuePrototype("char* ext_job_get_stdout_file(ext_job)")
    _set_stdout_file            = QueuePrototype("void ext_job_set_stdout_file(ext_job, char*)")
    _get_stderr_file            = QueuePrototype("char* ext_job_get_stderr_file(ext_job)")
    _set_stderr_file            = QueuePrototype("void ext_job_set_stderr_file(ext_job, char*)")
    _get_target_file            = QueuePrototype("char* ext_job_get_target_file(ext_job)")
    _set_target_file            = QueuePrototype("void ext_job_set_target_file(ext_job, char*)")
    _get_executable             = QueuePrototype("char* ext_job_get_executable(ext_job)")
    _set_executable             = QueuePrototype("void ext_job_set_executable(ext_job, char*)")
    _get_max_running            = QueuePrototype("int ext_job_get_max_running(ext_job)")
    _set_max_running            = QueuePrototype("void ext_job_set_max_running(ext_job, int)")
    _get_max_running_minutes    = QueuePrototype("int ext_job_get_max_running_minutes(ext_job)")
    _set_max_running_minutes    = QueuePrototype("void ext_job_set_max_running_minutes(ext_job, int)")
    _get_environment            = QueuePrototype("void* ext_job_get_environment(ext_job)")
    _set_environment            = QueuePrototype("void ext_job_add_environment(ext_job, char*, char*)")
    _clear_environment          = QueuePrototype("void ext_job_clear_environment(ext_job)")
    _save                       = QueuePrototype("void ext_job_save(ext_job)")


    def __init__(self, config_file, private, name = None , license_root_path = None , search_PATH = True):
        if os.path.isfile( config_file ):
            if name is None:
                name = os.path.basename( config_file )

            c_ptr = self._fscanf_alloc(name, license_root_path, private, config_file , search_PATH)
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / job_queue / ext_job.py View on Github external
#  See the GNU General Public License at  
#  for more details.
import os.path

from cwrap import BaseCClass
from ert.job_queue import QueuePrototype


class ExtJob(BaseCClass):
    TYPE_NAME                   = "ext_job"
    _alloc                      = QueuePrototype("void* ext_job_alloc(char*, char*, int)", bind = False)
    _fscanf_alloc               = QueuePrototype("void* ext_job_fscanf_alloc(char*, char*, bool, char* , bool)", bind = False)
    _free                       = QueuePrototype("void ext_job_free( ext_job )")
    _get_help_text              = QueuePrototype("char* ext_job_get_help_text(ext_job)")
    _get_name                   = QueuePrototype("char* ext_job_get_name(ext_job)")
    _get_private_args_as_string = QueuePrototype("char* ext_job_get_private_args_as_string(ext_job)")
    _set_private_args_as_string = QueuePrototype("void ext_job_set_private_args_from_string(ext_job, char*)")
    _is_private                 = QueuePrototype("int ext_job_is_private(ext_job)")
    _get_config_file            = QueuePrototype("char* ext_job_get_config_file(ext_job)")
    _set_config_file            = QueuePrototype("void ext_job_set_config_file(ext_job, char*)")
    _get_stdin_file             = QueuePrototype("char* ext_job_get_stdin_file(ext_job)")
    _set_stdin_file             = QueuePrototype("void ext_job_set_stdin_file(ext_job, char*)")
    _get_stdout_file            = QueuePrototype("char* ext_job_get_stdout_file(ext_job)")
    _set_stdout_file            = QueuePrototype("void ext_job_set_stdout_file(ext_job, char*)")
    _get_stderr_file            = QueuePrototype("char* ext_job_get_stderr_file(ext_job)")
    _set_stderr_file            = QueuePrototype("void ext_job_set_stderr_file(ext_job, char*)")
    _get_target_file            = QueuePrototype("char* ext_job_get_target_file(ext_job)")
    _set_target_file            = QueuePrototype("void ext_job_set_target_file(ext_job, char*)")
    _get_executable             = QueuePrototype("char* ext_job_get_executable(ext_job)")
    _set_executable             = QueuePrototype("void ext_job_set_executable(ext_job, char*)")
    _get_max_running            = QueuePrototype("int ext_job_get_max_running(ext_job)")
    _set_max_running            = QueuePrototype("void ext_job_set_max_running(ext_job, int)")