Context#

class pharmpy.workflows.Context(name, ref=None, common_options=None)[source]#

Bases: ABC

Context for runs

A database of results, metadata and run files for one tool run

Parameters:
  • name (str) – Name of the context

  • ref (str) – A reference (path) to the context

Attributes Summary

context_path

model_database

ModelDatabase to store results of models run in context

Methods Summary

abort_workflow(message)

call_workflow(workflow, unique_name)

create_subcontext(name)

Create a new subcontext of this context

exists(name[, ref])

get_model_context_path(model)

get_parent_context()

Get the parent context of this context

get_subcontext(name)

Get one of the subcontexts of this context

list_all_names()

Retrieve a list of all model names in the context

list_all_subcontexts()

Retrieve a list of the names of all subcontexts in the context

log_error(message[, model])

Add an error message to the log

log_info(message[, model])

Add an info message to the log

log_message(severity, message[, model])

Add a message to the log

log_warning(message[, model])

Add a warning message to the log

retrieve_annotation(name)

Retrieve an annotation for a model

retrieve_common_options()

retrieve_final_model_entry()

retrieve_input_model_entry()

retrieve_key(name)

Retrive the key corresponding to a model name

retrieve_log([level])

Retrieve the entire log all - the entire log current - only the current Context level lower - current and sub levels

retrieve_metadata()

Read tool metadata

retrieve_model_entry(name)

retrieve_results()

Retrieve tool results

store_annotation(name, annotation)

Store an annotation string (description) for a model

store_final_model_entry(me)

store_input_model_entry(me)

store_key(name, key)

Associate a key with a model name

store_message(severity, ctxpath, date, message)

store_metadata(metadata)

Store tool metadata

store_model_entry(me)

store_results(res)

Store tool results

Attributes Documentation

context_path#
model_database#

ModelDatabase to store results of models run in context

Methods Documentation

abort_workflow(message)[source]#
call_workflow(workflow, unique_name)[source]#
abstract create_subcontext(name)[source]#

Create a new subcontext of this context

abstract static exists(name, ref=None)[source]#
get_model_context_path(model)[source]#
abstract get_parent_context()[source]#

Get the parent context of this context

abstract get_subcontext(name)[source]#

Get one of the subcontexts of this context

abstract list_all_names()[source]#

Retrieve a list of all model names in the context

abstract list_all_subcontexts()[source]#

Retrieve a list of the names of all subcontexts in the context

log_error(message, model=None)[source]#

Add an error message to the log

log_info(message, model=None)[source]#

Add an info message to the log

Currently with echo to stdout. In the future this could be changed or be configurable.

log_message(severity, message, model=None)[source]#

Add a message to the log

log_warning(message, model=None)[source]#

Add a warning message to the log

abstract retrieve_annotation(name)[source]#

Retrieve an annotation for a model

abstract retrieve_common_options()[source]#
retrieve_final_model_entry()[source]#
retrieve_input_model_entry()[source]#
abstract retrieve_key(name)[source]#

Retrive the key corresponding to a model name

This key can be used to lookup the model in the model database

abstract retrieve_log(level='all')[source]#

Retrieve the entire log all - the entire log current - only the current Context level lower - current and sub levels

abstract retrieve_metadata()[source]#

Read tool metadata

retrieve_model_entry(name)[source]#
abstract retrieve_results()[source]#

Retrieve tool results

Returns:

Results – Tool results object

abstract store_annotation(name, annotation)[source]#

Store an annotation string (description) for a model

store_final_model_entry(me)[source]#
store_input_model_entry(me)[source]#
abstract store_key(name, key)[source]#

Associate a key with a model name

abstract store_message(severity, ctxpath, date, message)[source]#
abstract store_metadata(metadata)[source]#

Store tool metadata

Parameters:

metadata (dict) – Tool metadata dictionary

store_model_entry(me)[source]#
abstract store_results(res)[source]#

Store tool results

Parameters:

res (Results) – Tool results object