Factored out utility functions and methods specifically used in conjunction with
evoland_db and its subclasses.
Usage
get_evoland_db_read_expr(self, super, table_name)
run_parallel_evoland(items, worker_fun, parent_db, cluster = NULL, ...)Arguments
- self
The
evoland_dbinstance- table_name
The name of the table to read from
- items
A list of items to iterate over
- worker_fun
A function to apply to each item, with signature
worker_fun(item, db, ...). Thedbargument will be a newevoland_dbinstance for each worker.- parent_db
An evoland_db instance; used for its
pathandid_run; or passed directly to the worker for serial case.- cluster
An optional cluster object created by
parallel::makeCluster()ormirai::make_cluster().- ...
Additional arguments passed to
worker_fun.
Functions
get_evoland_db_read_expr(): Gets the read expression for a given table, taking into account the run lineage and distinctness columns. If the table has noid_runcolumn or is theruns_ttable itself, falls back to the default read expression. Otherwise, constructs a read expression that filters for the activeid_runand its lineage, using the distinctness columns to determine which slices of data to include.run_parallel_evoland(): Run a worker function in parallel with anevoland_dbinstance; takes an (optional) worker cluster, a worker function, a set of items, and a parentevoland_dbinstance. If no cluster is passed, apply the worker serially. If a cluster is passed, each worker gets its own database instance derived from the parent database.