csv.pre_one_process

View page source

Predict Using One Process

Keep predicting for as long as thee are jobs left to predict for.

Prototype

# at_cascade.csv.pre_one_process
def pre_one_process(
  fit_dir,
    sim_dir,
    option_predict,
    all_node_database,
    all_covariate_table,
    job_table,
    node_table,
    root_node_id,
    root_split_reference_id,
    at_cascade_log_dict,
    job_status_name,
    shared_job_status_name,
    shared_lock,
) :
    assert type(fit_dir)                    == str
    assert sim_dir == None or type(sim_dir) == str
    assert type(option_predict)             == dict
    assert type(all_node_database)          == str
    assert type(all_covariate_table)        == list
    assert type( all_covariate_table[0] )   == dict
    assert type(job_table)                  == list
    assert type(node_table)                 == list
    assert type(node_table[0])              == dict
    assert type(root_node_id)               == int
    assert type(root_split_reference_id)    == int
    assert type(at_cascade_log_dict)        == dict
    assert type(job_status_name)            == list
    assert type( job_status_name[0] )       == str
    assert type(shared_job_status_name)     == str
    assert type(shared_lock)                == multiprocessing.synchronize.Lock

fit_dir

Same as the csv fit fit_dir .

sim_dir

Same as sim_dir .

option_predict

This is an in memory representation of option_predict.csv .

all_node_database

This is the all node database for this fit.

all_covariate_table

This is an in memory representation of covariate.csv .

job_table

is the job_table for this cascade.

node_table

is the dismod_at node table for this cascade.

root_node_id

is the node table id for the root node of the cascade.

root_split_reference_id

is the split_reference table id for the root job of the cascade

at_cascade_log_dict

For each job_name in the job table that is a key in at_cascade_log_dict. The corresponding value

at_cascade_log_dict [ job_name ]

is a non-empty list of str containing at_cascade messages in the log table for that job. If a job_name is not a key is in at_cascade_log_dict, there were no at_cascade messages for that job.

job_status_name

is the name corresponding to each possible job status integer values. If i is an integer job status value, job_status_name [ i ] is the corresponding name.

Name

Meaning

‘skip’

job is not included in the predictions

‘ready’

job is ready to run

‘run’

job is running

‘done’

job finished running

shared_job_status_name

This the name of the shared job status memory. The corresponding multiprocessing shared memory is a numpy array with dtype equal to int and with length equal to the length of job_table . The value shared_job_status [ job_table_index ] is the integer status code for the corresponding job; see job_status_name above.

shared_lock

This lock must be acquired during the time that a process reads or changes shared_job_status .

Csv Output Files

see Csv Output Files

Parallel Processing

Always copy dismod_at.db to another file before predicting with it because dismod_at.db may be an ancestor for another prediction or fit that is running in parallel.