OHDSI Home | Forums | Wiki | Github

Achilles Threading Issues

Hello OHDSI world,

Trying to run achilles with the below script in a docker container in AWS lambda. However, it keeps failing with the following issues:

  1. If I use numThreads = 1, it fails with org.postgresql.util.PSQLException: ERROR: syntax error at or near "."

    Reading Error in running Achilles - #11 by t_abdul_basser makes me assume I should run with numThreads = 2

  2. If I use numThreads = 2, it fails with Error in $<-.data.frame(*tmp*, “runTime”, value = NA)

    Reading Error in achilles execution makes me think I should run numThreads = 1

What is the proper solution? How do I fix these errors?

R version 4.3.2
Achilles version 1.7.2

# set up database connection
connectionDetails <- DatabaseConnector::createConnectionDetails(
  dbms = "postgresql",
  server = paste(Sys.getenv("host"), Sys.getenv("dbname"), sep="/"),
  user = Sys.getenv("username"),
  password = Sys.getenv("password"),
  port = as.numeric(Sys.getenv("port")),
  # pathToDriver =<set by $echo $DATABASECONNECTOR_JAR_FOLDER>,
)

# make sure to set your environment variables before running this code
# configure achilles
achilles_config <- list(
  connectionDetails = connectionDetails,
  cdmDatabaseSchema = Sys.getenv("cdmDatabaseSchema"),
  resultsDatabaseSchema = Sys.getenv("resultsDatabaseSchema"),
  vocabDatabaseSchema = Sys.getenv("vocabDatabaseSchema"),
  createTable = as.logical(Sys.getenv("createTable", TRUE)),
  smallCellCount = as.numeric(Sys.getenv("smallCellCount", 5)),
  cdmVersion = as.numeric(Sys.getenv("cdmVersion", 5.4)),
  createIndices = as.logical(Sys.getenv("createIndices", TRUE)),
  numThreads = as.numeric(Sys.getenv("numThreads", 2)),
  dropScratchTables = as.logical(Sys.getenv("dropScratchTables", TRUE)),
  verboseMode = as.logical(Sys.getenv("verboseMode", TRUE)),
  optimizeAtlasCache = as.logical(Sys.getenv("optimizeAtlasCache", TRUE)),
  defaultAnalysesOnly = as.logical(Sys.getenv("defaultAnalysesOnly", TRUE)),
  updateGivenAnalysesOnly = as.logical(Sys.getenv("updateGivenAnalysesOnly", FALSE)),
  sqlOnly = as.logical(Sys.getenv("sqlOnly", FALSE)),
  sqlDialect = "postgresql"
)

# log
print(str(achilles_config))

# Run Achilles
do.call(Achilles::achilles, achilles_config)
t