getTaskIdByName {openMpp}R Documentation

Return modeling task id by name

Description

Return modeling task id by name

Usage

getTaskIdByName(dbCon, defRs = NA, taskName)

Arguments

dbCon

database connection

defRs

(optional) model definition: database rows describing model input parameters and output tables

taskName

name of modeling task

Details

Return modeling task id by name. If there is no task with that name then return is negative. If there are multiple tasks with that name then return min(task id) with such name. If model definition defRs argument supplied then search for within specific model.

Modeling task is named set of model inputs and contains name and vector of model workset id's. Please see createWorkset for mode details about workset (workset: working set of model input parameters).

Modeling task is a convinient way to bundle together multiple inputs of the model. After task created you can run the model with specifing task name or task id and model will iterate through task input worksets and produce output result for each of those inputs.

Value

modeling task id: positive integer on success or negative if not found.

Note

To run examples you must have modelOne database modelOne.sqlite in current directory

Author(s)

amc1999

References

OpenM++ documentation: https://github.com/openmpp/openmpp.github.io/wiki

See Also

getModel createTask selectTask selectTaskRun

Examples

  theDb <- dbConnect(RSQLite::SQLite(), "modelOne.sqlite", synchronous = "full")
  invisible(dbGetQuery(theDb, "PRAGMA busy_timeout = 86400")) # recommended

  # try to find "taskOne" task id for any model
  taskId <- getTaskIdByName(theDb, taskName = "taskOne")
  if (taskId <= 0L) warning("task not found: ", "taskOne")
  
  # get model by name: use such call if you have only one version of the model
  defRs <- getModel(theDb, "modelOne")

  # try to find "taskOne" task id for "modelOne"
  taskId <- getTaskIdByName(theDb, defRs, "taskOne")
  if (taskId <= 0L) warning("task not found: ", "taskOne")

  dbDisconnect(theDb)

[Package openMpp version 0.8.6 Index]