def _submit_resource_request(self):
        """
        **Purpose**: Create and submits a RADICAL Pilot Job as per the user
                     provided resource description
        """

        try:

            self._prof.prof('creating rreq', uid=self._uid)

            def _pilot_state_cb(pilot, state):
                self._logger.info('Pilot %s state: %s' % (pilot.uid, state))

                if state == rp.FAILED:
                    self._logger.error('Pilot has failed')

                elif state == rp.DONE:
                    self._logger.error('Pilot has completed')

            self._session = rp.Session(dburl=self._mlab_url, uid=self._sid)
            self._pmgr = rp.PilotManager(session=self._session)
            self._pmgr.register_callback(_pilot_state_cb)

            pd_init = {
                'resource': self._resource,
                'runtime': self._walltime,
                'cores': self._cpus,
                'project': self._project,
            }

            if self._gpus:
                pd_init['gpus'] = self._gpus

            if self._access_schema:
                pd_init['access_schema'] = self._access_schema

            if self._queue:
                pd_init['queue'] = self._queue

            if self._rts_config.get('sandbox_cleanup', None):
                pd_init['cleanup'] = True

            # Create Compute Pilot with validated resource description
            pdesc = rp.ComputePilotDescription(pd_init)

            self._prof.prof('rreq created', uid=self._uid)

            # Launch the pilot
            self._pilot = self._pmgr.submit_pilots(pdesc)

            self._prof.prof('rreq submitted', uid=self._uid)

            shared_staging_directives = list()
            for data in self._shared_data:
                temp = {
                    'source': data,
                    'target': 'pilot:///' + os.path.basename(data)
                }
                shared_staging_directives.append(temp)

            self._pilot.stage_in(shared_staging_directives)

            self._prof.prof('shared data staging initiated', uid=self._uid)
            self._logger.info('Resource request submission successful.. waiting for pilot to go Active')

            # Wait for pilot to go active
            self._pilot.wait([rp.PMGR_ACTIVE, rp.FAILED, rp.CANCELED])

            self._prof.prof('resource active', uid=self._uid)
            self._logger.info('Pilot is now active')

        except KeyboardInterrupt:

            if self._session:
                self._session.close()

            self._logger.exception('Execution interrupted by user (you probably hit Ctrl+C), ' +
                               'trying to exit callback thread gracefully...')
            raise KeyboardInterrupt

        except Exception, ex:
            self._logger.exception('Resource request submission failed')
            raise
def _submit_resource_request ( self ) : try : self . _prof . prof ( 'creating rreq' , uid = self . _uid ) def _pilot_state_cb ( pilot , state ) : self . _logger . info ( 'Pilot %s state: %s' % ( pilot . uid , state ) ) if state == rp . FAILED : self . _logger . error ( 'Pilot has failed' ) elif state == rp . DONE : self . _logger . error ( 'Pilot has completed' ) self . _session = rp . Session ( dburl = self . _mlab_url , uid = self . _sid ) self . _pmgr = rp . PilotManager ( session = self . _session ) self . _pmgr . register_callback ( _pilot_state_cb ) pd_init = { 'resource' : self . _resource , 'runtime' : self . _walltime , 'cores' : self . _cpus , 'project' : self . _project , } if self . _gpus : pd_init [ 'gpus' ] = self . _gpus if self . _access_schema : pd_init [ 'access_schema' ] = self . _access_schema if self . _queue : pd_init [ 'queue' ] = self . _queue if self . _rts_config . get ( 'sandbox_cleanup' , None ) : pd_init [ 'cleanup' ] = True pdesc = rp . ComputePilotDescription ( pd_init ) self . _prof . prof ( 'rreq created' , uid = self . _uid ) self . _pilot = self . _pmgr . submit_pilots ( pdesc ) self . _prof . prof ( 'rreq submitted' , uid = self . _uid ) shared_staging_directives = list ( ) for data in self . _shared_data : temp = { 'source' : data , 'target' : 'pilot:///' + os . path . basename ( data ) } shared_staging_directives . append ( temp ) self . _pilot . stage_in ( shared_staging_directives ) self . _prof . prof ( 'shared data staging initiated' , uid = self . _uid ) self . _logger . info ( 'Resource request submission successful.. waiting for pilot to go Active' ) self . _pilot . wait ( [ rp . PMGR_ACTIVE , rp . FAILED , rp . CANCELED ] ) self . _prof . prof ( 'resource active' , uid = self . _uid ) self . _logger . info ( 'Pilot is now active' ) except KeyboardInterrupt : if self . _session : self . _session . close ( ) self . _logger . exception ( 'Execution interrupted by user (you probably hit Ctrl+C), ' + 'trying to exit callback thread gracefully...' ) raise KeyboardInterrupt except Exception , ex : self . _logger . exception ( 'Resource request submission failed' ) raise
**Purpose**: Create and submits a RADICAL Pilot Job as per the user
                     provided resource description