getTaskFirstRunId {openMpp}R Documentation

Return first id of modeling task run

Description

Return first id of modeling task run

Usage

getTaskFirstRunId(dbCon, taskId)

Arguments

dbCon

database connection

taskId

modeling task id

Details

Return id of the first run for modeling task, it is positive integer. If there is no run(s) for that modeling task then return negative value.

Value

Task run id: positive integer on success or negative on 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

getTaskLastRunId getModel getWorksetRunIds

Examples

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

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

  # get first task run id
  firstId <- getTaskFirstRunId(theDb, taskId)
  if (firstId <= 0L) stop("task run(s) not found")

  # get last (most recent) task run id
  lastId <- getTaskLastRunId(theDb, taskId)
  if (lastId <= 0L) warning("task run(s) not found")
  
  dbDisconnect(theDb)

[Package openMpp version 0.8.6 Index]