Пример #1
0
def update_runtime(name, config=None):
    config = default_config(config)
    storage_config = extract_storage_config(config)
    internal_storage = InternalStorage(storage_config)
    compute_config = extract_compute_config(config)
    compute_handler = Compute(compute_config)

    timeout = config['pywren']['runtime_timeout']
    logger.info('Updating runtime: {}'.format(name))

    if name != 'all':
        runtime_meta = compute_handler.generate_runtime_meta(name)
    else:
        runtime_meta = None

    runtimes = compute_handler.list_runtimes(name)

    for runtime in runtimes:
        compute_handler.create_runtime(runtime[0], runtime[1], timeout)
        if runtime_meta:
            try:
                runtime_key = compute_handler.get_runtime_key(
                    runtime[0], runtime[1])
                internal_storage.put_runtime_meta(runtime_key, runtime_meta)
            except Exception:
                raise ("Unable to upload 'preinstalled modules' file into {}".
                       format(internal_storage.backend))
Пример #2
0
def delete_runtime(name, config=None):
    config = default_config(config)
    storage_config = extract_storage_config(config)
    internal_storage = InternalStorage(storage_config)
    compute_config = extract_compute_config(config)
    compute_handler = Compute(compute_config)

    runtimes = compute_handler.list_runtimes(name)
    for runtime in runtimes:
        compute_handler.delete_runtime(runtime[0], runtime[1])
        runtime_key = compute_handler.get_runtime_key(runtime[0], runtime[1])
        internal_storage.delete_runtime_meta(runtime_key)