Skip to content

Actions

Alejo Carballude requested to merge feature/actions into develop

Context

Cloudsim contains pools of workers in charge of launching and terminating simulations; operations composed of several jobs. The code for these jobs is currently highly coupled, making it difficult to test, debug and extend.

Workers are susceptible to server restarts as they don't have ways of recovering state after a restart. This results in simulations being marked as failed (i.e. ServerRestart) when a server restart is performed.

Change

The actions package provides a way to split these simulation operations into multiple jobs, automate the storage and loading of state when recovering from an interruption and providing a way for applications to create their own launch processes.

App extensibility

Other information

To help with reviews, here's a list of the files as a review order suggestion, as well as a brief description of what to look for in each file.

# file description
1 actions.go An Action contains a sequence of Jobs that perform an operation (e.g. launch simulation, terminate simulation). Actions must be registered and launched using a Service instance.
2 job.go A Job is the basic building block of the actions package. A Job represents a single operation. Multiple Jobs can be chained in an Action.
3 service.go Registers and launches Actions. Applications can register and launch their custom Actions in a Service instance.
4 service_execute_input.go ExecuteInput contains input data required by Service.Execute (essentially a DTO). It is used by the Service to know when to create a new Deployment for an Action or load and resume a previous Deployment instead.
5 deployment.go Contains the Deployment model. A Deployment persists an action execution state. Whenever an Action is executed through a Service, a Deployment entry is created to keep track of the state of the execution.
6 deployment_error.go Contains the DeploymentError model. DeploymentError entries persist errors encountered while executing an action.
7 deployment_data.go Contains the deploymentData model. deploymentData entries contain data used by each Job in a Deployment.
8 job_error_handler.go Contains functions used to wrap Job functions with error handlers.
9 job_data_type_registry.go Contains a data type registry. The registry maps struct names with their types. It is used to automatically unmarshal data from persistent storage.
10 db.go Contains database table migration helper functions.

Additional documentation

Reviewers

@marcoshuck, @nkoenig

Edited by Alejo Carballude

Merge request reports