store_model_fit.RdThis function stores a model fit object in an Azure Blob Container and the data into JPE database. It uploads the model data to Azure Blob Storage and updates the database with relevant information about the model run and parameters.
store_model_fit(
con,
storage_account = "jpemodelresults",
container_name = "model-results",
access_key = Sys.getenv("AZ_CONTAINER_ACCESS_KEY"),
model_fit_object,
model_inputs,
results_name,
description,
...
)A connection object to the database.
A string specifying the Azure storage account name, typically jpemodelresults.
A string specifying the container name in the Azure storage account, typically model-results.
A string specifying the Azure storage access key with write permissions. Default is stored in your R environment under AZ_CONTAINER_ACCESS_KEY.
The model result object that needs to be stored, of class stanfit or bugs.
The inputs used to fit the model_fit_object.
A string specifying a name to identify the model results in Azure Blob Storage. One of bt_spas_x,
pcap_all, pcap_mainstem, p2s, stock_recruit, inseason, survival.
A description of the model fit you are uploading.
Additional named arguments to be passed as metadata to the blob storage.
A string representing the URL of the blob in Azure Blob Storage where the model fit object, diagnostic plots, and inputs are stored.
if (FALSE) { # \dontrun{
con <- DBI::dbConnect(RPostgres::Postgres(),
dbname = cfg$db_name,
host = cfg$db_host,
port = cfg$db_port,
user = cfg$db_user,
password = cfg$db_password)
blob_url <- store_model_fit(con,
storage_account = "my_storage_account",
container_name = "my_container",
access_key = "my_access_key",
model_fit_object = model_results,
model_inputs = model_inputs,
results_name = "model_name",
description = "model_description")
print(blob_url)
dbDisconnect(con)
} # }