wrench::FunctionManager

class FunctionManager : public wrench::Service

A manager for interacting with a serverless compute service.

Public Functions

~FunctionManager() override

Destructor.

std::shared_ptr<Invocation> invokeFunction(const std::shared_ptr<Function> &function, const std::shared_ptr<ServerlessComputeService> &sl_compute_service, const std::shared_ptr<FunctionInput> &function_input)

Invokes a function on a ServerlessComputeService.

Parameters:
  • _function – the function to invoke

  • sl_compute_service – the ServerlessComputeService to invoke the function on

  • function_input – the input (object) to the function

Returns:

std::shared_ptr<Invocation> an Invocation object created by the ServerlessComputeService

bool isDone(const std::shared_ptr<Invocation> &invocation)

State finding method to check if an invocation is done.

Parameters:

invocation – the invocation to check

Returns:

true if the invocation is done

Returns:

false if the invocation is not done

void kill()

Kill the function manager.

std::shared_ptr<Function> registerFunction(const std::string &name, const std::function<std::shared_ptr<FunctionOutput>(const std::shared_ptr<FunctionInput>&, const std::shared_ptr<StorageService>&)> &code, const std::shared_ptr<Image> &image, const std::shared_ptr<ServerlessComputeService> &compute_service, double time_limit_in_seconds, sg_size_t disk_space_limit_in_bytes, sg_size_t RAM_limit_in_bytes, sg_size_t ingress_in_bytes, sg_size_t egress_in_bytes)

Registers a function with the ServerlessComputeService.

Parameters:
  • name – the function’s name

  • code – the function’s code

  • image – the function’s image

  • sl_compute_service – the ServerlessComputeService to register the function on

  • time_limit_in_seconds – the time limit for the function execution

  • disk_space_limit_in_bytes – the disk space limit for the function

  • RAM_limit_in_bytes – the RAM limit for the function

  • ingress_in_bytes – the ingress data limit (this is currently completely IGNORED)

  • egress_in_bytes – the egress data limit (this is currently completely IGNORED)

Throws:

ExecutionException – if the function registration fails

Returns:

true if the function was registered successfully

virtual void stop() override

Stop the manager.

void wait_all(const std::vector<std::shared_ptr<Invocation>> &invocations)

Waits for a list of invocations to finish.

Parameters:

invocations – the invocations to wait for

void wait_one(const std::shared_ptr<Invocation> &invocation)

Waits for a single invocation to finish.

Parameters:

invocation – the invocation to wait for

Public Static Functions

static std::shared_ptr<Image> createImage(const std::string &name, const std::set<std::shared_ptr<ImageLayer>> &layers)

create an image

Parameters:
  • name – a name

  • layers – The layers that comprise the image

Returns:

static std::shared_ptr<Image> createImage(const std::string &name, const std::shared_ptr<Image> &parent_image, const std::set<std::shared_ptr<ImageLayer>> &additional_layers)
Parameters:
  • name –

  • parent_image – The parent image

  • additional_layers – The additional layers that make up the image

Returns:

static std::shared_ptr<ImageLayer> createImageLayer(const std::string &name, const std::shared_ptr<FileLocation> &location, sg_size_t ram_foot_print)

Create an image layer.

Parameters:
  • name – a name

  • location – the location of the image layer file

  • ram_foot_print – the RAM footprint of the image layer

Returns:

An image layer