node: node class

nodeR Documentation

node class

Description

Node is a basic building block of an rflow DAG.

Usage

node$new(id = "node")

Format

R6Class object.

Details

Nodes may represent different types of data targets (R objects, files, database tables), or jobs. Interconnected nodes together function as basic building elements of directed acyclic graph (DAG).

Nodes are implemented using R6 classes. There are various flavors of the basic node class (r_node, db_node, file_node) that have their specific requirements and features

Constructing nodes

  • from stored state

  • from lists (coming from TOML, YAML...)

Value

Object of R6Class with basic functionality for rflows.

Methods

$make() or make(node)

This method is used to build/make targets. It recursively solves dependencies by building all targets for nodes declared or detected as a dependency.

$eval()

Compared to make(), eval() only runs the code/job associated with the node alone. It does not try to ensure all the dependencies are ready.

$process()

process() is usually used internally by eval() and should not be called directly

$value

Returns target's value. Targets such as database tables or csv files are automatically convert into R values.

$exists()

Checks whether the target exists or not.

$time_to_eval()

Returns a record(s) of time to evaluate.

Public fields

id

character; unique id

env

character; name of a environment (container or group of objects)

name

character; object's name

desc

character; description

depends

character; vector of upstream nodes (other nodes this node is depending on)

Methods

Public methods


Method vis_params_process()

Usage
node$vis_params_process(params)

Method set_id()

Usage
node$set_id(id, name, env)

Method set_persistence()

Usage
node$set_persistence(persistence)

Method print()

Usage
node$print(...)

Method label()

Usage
node$label()

Method title()

Usage
node$title()

Method new()

Usage
node$new(
  id = NULL,
  name = NULL,
  env = NULL,
  desc = NULL,
  tags = NULL,
  depends = NULL,
  trigger_defchange = NULL,
  trigger_condition = NULL,
  definition_hash = NULL,
  persistence = list(enabled = FALSE),
  .last_evaluated = NULL,
  .last_changed = NULL,
  .trigger_defchange = NULL,
  .time_to_eval = NULL,
  cache = NULL,
  mode = NULL,
  vis_params = NULL,
  validators = NULL,
  logging = FALSE,
  loggers = NULL,
  store = TRUE,
  ...
)

Method store_state()

Usage
node$store_state(public_fields = NULL, private_fields = NULL)

Method update_definition()

Usage
node$update_definition(
  id = NULL,
  type = NULL,
  desc = NULL,
  tags = NULL,
  depends = NULL,
  definition_hash = NULL,
  trigger_condition = NULL,
  vis_params = NULL,
  validators = NULL,
  ...,
  store = TRUE,
  logging = FALSE,
  loggers = NULL,
  verbose = TRUE
)

Method set_upstream()

Usage
node$set_upstream(obj)

Method set_downstream()

Usage
node$set_downstream(obj)

Method connect_to()

Usage
node$connect_to(id)

Method connect()

Usage
node$connect(verbose = TRUE)

Method get()

Usage
node$get()

Method remove()

Usage
node$remove()

Method check_trigger_condition()

Usage
node$check_trigger_condition()

Method check_triggers()

Usage
node$check_triggers(verbose = TRUE, verbose_prefix = "")

Method reset_triggers()

Usage
node$reset_triggers()

Method eval()

Usage
node$eval(verbose = TRUE, verbose_prefix = "")

Method process()

Usage
node$process(verbose = TRUE, verbose_prefix = "")

Method changed()

Usage
node$changed(verbose = TRUE, verbose_prefix = "")

Method make()

Usage
node$make(
  force = FALSE,
  verbose = TRUE,
  verbose_prefix = "",
  .visited = as.environment(list(ids = character()))
)

Method validate()

Usage
node$validate(verbose = TRUE, verbose_prefix = "")

Method time_to_eval()

Usage
node$time_to_eval(what = getOption("RFLOW_TIME_TO_EVAL", "LAST"))

Method clone()

The objects of this class are cloneable with this method.

Usage
node$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


vh-d/Rflow documentation built on May 11, 2022, 2:53 a.m.