Skip to contents

Class simulating a ConnectTask

Class simulating a ConnectTask

Usage


sim_task <- SimTask$new("task0", "always", 0)
sim_task$execute()

Details

This class simulates a ConnectTask running in a ConnectDAG. It is inherited from ConnectTask, with the only differences being to the `new()` and `execute_task()` methods. However, when using a SimTask, no attempt is made to validate the content is published to Posit Connect. Additionally, you may control the probability a task will fail. This allows you to simulate the DAG under specific scenarios. This class is used heavily in tests when it is desirable to force an upstream task failure.

See also

Other R6 classes: ConnectDAG, ConnectTask

Super class

connectapi.dag::ConnectTask -> SimTask

Public fields

fail_prob

A numeric between 0 and 1, determining the chance of a failure

Methods

Inherited methods


Method new()

Initializes a new SimTask

Usage

SimTask$new(guid, trigger_rule = "all_success", fail_prob = 0.2)

Arguments

guid

A scalar character of the guid for the content item. Not validated in Posit Connect.

trigger_rule

A scalar character that defines state of dependency (upstream) tasks must be in to execute

fail_prob

A numeric between 0 and 1, determining the chance of a failure


Method execute()

Simulates the execution of task, taking into account failure probability

Usage

SimTask$execute(verbose = FALSE)

Arguments

verbose

Should the task print messages as it executes?


Method clone()

The objects of this class are cloneable with this method.

Usage

SimTask$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.