<s> """<STR_LIT>""" <EOL> import logging <EOL> try : <EOL> from drmaa import JobState <EOL> except ( OSError , ImportError ) : <EOL> JobState = None <EOL> from . external import ExternalBaseManager <EOL> from . . util . drmaa import DrmaaSessionFactory <EOL> from pulsar . managers import status <EOL> log = logging . getLogger ( __name__ ) <EOL> IGNORE_SUBMISSION_SPEC_MESSAGE = "<STR_LIT>" <EOL> class BaseDrmaaManager ( ExternalBaseManager ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , app , ** kwds ) : <EOL> """<STR_LIT>""" <EOL> super ( BaseDrmaaManager , self ) . __init__ ( name , app , ** kwds ) <EOL> self . native_specification = kwds . get ( '<STR_LIT>' , None ) <EOL> drmaa_session_factory_class = kwds . get ( '<STR_LIT>' , DrmaaSessionFactory ) <EOL> drmaa_session_factory = drmaa_session_factory_class ( ) <EOL> self . drmaa_session = drmaa_session_factory . get ( ) <EOL> def shutdown ( self , timeout = None ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> super ( BaseDrmaaManager , self ) . shutdown ( timeout ) <EOL> except Exception : <EOL> pass <EOL> self . drmaa_session . close ( ) <EOL> def _get_status_external ( self , external_id ) : <EOL> drmaa_state = self . drmaa_session . job_status ( external_id ) <EOL> return { <EOL> JobState . UNDETERMINED : status . COMPLETE , <EOL> JobState . QUEUED_ACTIVE : status . QUEUED , <EOL> JobState . SYSTEM_ON_HOLD : status . QUEUED , <EOL> JobState . USER_ON_HOLD : status . QUEUED , <EOL> JobState . USER_SYSTEM_ON_HOLD : status . QUEUED , <EOL> JobState . RUNNING : status . RUNNING , <EOL> JobState . SYSTEM_SUSPENDED : status . QUEUED , <EOL> JobState . USER_SUSPENDED : status . QUEUED , <EOL> JobState . DONE : status . COMPLETE , <EOL> JobState . FAILED : status . COMPLETE , <EOL> } [ drmaa_state ] <EOL> def _build_template_attributes ( self , job_id , command_line , dependencies_description = None , env = [ ] , submit_params = { } ) : <EOL> stdout_path = self . _stdout_path ( job_id ) <EOL> stderr_path = self . _stderr_path ( job_id ) <EOL> attributes = { <EOL> "<STR_LIT>" : self . _setup_job_file ( job_id , command_line , dependencies_description = dependencies_description , env = env ) , <EOL> "<STR_LIT>" : self . _job_name ( job_id ) , <EOL> "<STR_LIT>" : "<STR_LIT>" % stdout_path , <EOL> "<STR_LIT>" : "<STR_LIT>" % stderr_path , <EOL> } <EOL> submit_native_specification = submit_params . get ( "<STR_LIT>" , None ) <EOL> native_specification = None <EOL> if self . native_specification : <EOL> native_specification = self . native_specification <EOL> if submit_native_specification is not None : <EOL> log . warn ( IGNORE_SUBMISSION_SPEC_MESSAGE ) <EOL> elif submit_native_specification : <EOL> native_specification = submit_params [ "<STR_LIT>" ] <EOL> if native_specification is not None : <EOL> attributes [ "<STR_LIT>" ] = native_specification <EOL> log . info ( "<STR_LIT>" % native_specification ) <EOL> else : <EOL> log . debug ( "<STR_LIT>" ) <EOL> return attributes <EOL> __all__ = [ "<STR_LIT>" ] </s>
