Rule

Reactive Rule

Description

Reactive Rule

Reactive Rule

Details

Rule

Base R6 class for reactive production rules.

Rules use a two-phase input model for performance:

  • planning/scheduling phase (inputs(), bind(), requirements()) works with ResourceSpec objects, not loaded resource payloads;

  • execution phase (run()) receives materialized input values loaded by the execution engine worker just-in-time.

This avoids repeated scheduler-side loading of large resources (for example GWAS summary statistics) and reduces data copying across async workers.

Practical guidance:

  • keep requirements() based on output.spec and bound specs/metadata;

  • if bind() needs cached metadata (e.g. genome build), prefer store$load.meta() over full store$load();

  • reserve heavy data access for run().

Public fields

name

Character. Rule name.

Methods

Public methods


Method new()

Create a Rule base class

Usage
Rule$new(name)
Arguments
name

Character; rule name


Method matches()

Check if the rule can produce an output

Usage
Rule$matches(output.spec)
Arguments
output.spec

ResourceSpec

Returns

Logical


Method inputs()

Build inputs for an output

Usage
Rule$inputs(output.spec)
Arguments
output.spec

ResourceSpec

Returns

Named list of inputs (ResourceSpec or NULL)


Method bind()

Bind derived inputs.

Usage
Rule$bind(inputs, store, output.spec = NULL)
Arguments
inputs

Named list of inputs.

store

ResourceStore.

output.spec

Output specification being prepared.

Returns

Named list of inputs.


Method requirements()

Compute requirements

Usage
Rule$requirements(output.spec, inputs)
Arguments
output.spec

ResourceSpec

inputs

Named list of bound input specifications.

Returns

Named list with cores/memory


Method run()

Execute the rule

Usage
Rule$run(output.spec, inputs, logger)
Arguments
output.spec

ResourceSpec

inputs

Named list of materialized resource values loaded by the execution engine worker.

logger

PolyLogger

Returns

List with data, meta, logs


Method print()

Print rule summary

Usage
Rule$print(...)
Arguments

Unused


Method clone()

The objects of this class are cloneable with this method.

Usage
Rule$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.