Пример #1
0
def _configure_drm(serverconfig):
    drmconfig_cmd = serverconfig.drmConfig.configureCmd
    drmconfig = {
        "SYSTEM": {
            "work_dir_host": serverconfig.wsConfig.workspaceRoot
        }
    }
    if DRM == drm_access2:
        cmd = DRM.create_configure_cmd(drmconfig_cmd, drmconfig)
        executor = cmd_executor.create(serverconfig.drmConfig,
                                       serverconfig.localcache,
                                       serverconfig.credentials.drmUsername,
                                       serverconfig.credentials.drmPassword)
        drm_response = _call_drm_configure(cmd, executor, drmconfig)

        def on_success(result):
            if result == CONFIG_OK:
                return CONFIG_OK, "DRM successfully configured."
            else:
                return CONFIG_ERROR, "Failure occurred while trying to configure DRM."

        def on_fail(reason):
            return CONFIG_ERROR, "Failure occurred while trying to configure DRM."

        drm_response.addCallback(on_success)
        drm_response.addErrback(on_fail)
    else:
        drm_response = Deferred()
        drm_response.callback(
            (CONFIG_OK, "DRM not configured in this version."))
    return drm_response
Пример #2
0
 def __init__(self, configuration, credentials, pkgdefs):
     """
     :param configuration: Configuration which contains the the details of
        * the local cache to be used to store fetched data
        * the workspace on the HPC submission host  
     """
     self._configuration = configuration
     self._drm_methods = _DRMMethods(configuration.drmConfig)
     self._cmd_executor = cmd_executor.create(configuration.drmConfig, configuration.localcache, credentials.drmUsername, credentials.drmPassword)
     self._job_queue = set()
     self._currently_running = {}
def _configure_drm(serverconfig):
    drmconfig_cmd=serverconfig.drmConfig.configureCmd
    drmconfig={"SYSTEM":{"work_dir_host":serverconfig.wsConfig.workspaceRoot}}
    if DRM==drm_access2:
        cmd=DRM.create_configure_cmd(drmconfig_cmd, drmconfig)
        executor = cmd_executor.create(serverconfig.drmConfig, serverconfig.localcache, serverconfig.credentials.drmUsername, serverconfig.credentials.drmPassword)
        drm_response = _call_drm_configure(cmd, executor, drmconfig) 
               
        def on_success(result):            
            if result==CONFIG_OK:
                return CONFIG_OK, "DRM successfully configured."
            else:
                return CONFIG_ERROR, "Failure occurred while trying to configure DRM."
    
        def on_fail(reason):
            return CONFIG_ERROR, "Failure occurred while trying to configure DRM."

        drm_response.addCallback(on_success)
        drm_response.addErrback(on_fail)    
    else:
        drm_response = Deferred()
        drm_response.callback((CONFIG_OK, "DRM not configured in this version."))
    return drm_response