fit_one_process

View page source

Fit Using One Process

Keep fitting jobs for as long as there are jobs ready to be fit.

Prototype

# at_cascade.fit_one_process
def fit_one_process(
    job_table,
    this_job_id,
    all_node_database,
    node_table,
    fit_integrand,
    skip_this_job,
    max_number_cpu,
    master_process,
    fit_type_list,
    job_status_name,
    shared_job_status_name,
    shared_number_cpu_inuse_name,
    shared_lock,
    shared_event,
) :
    assert type(job_table)            == list
    assert type(this_job_id)          == int
    assert type(all_node_database)    == str
    assert type(node_table)           == list
    assert type(fit_integrand)        == set
    assert type(skip_this_job)        == bool
    assert type(max_number_cpu)       == int
    assert type(master_process)       == bool
    assert type(fit_type_list)        == list
    assert type(job_status_name)      == list
    assert type( job_status_name[0] ) == str
    assert type(shared_job_status_name)       == str
    assert type(shared_number_cpu_inuse_name) == str
    assert type(shared_lock)          == multiprocessing.synchronize.Lock
    assert type(shared_event)         == multiprocessing.synchronize.Event

job_table

This is a job_table containing all the jobs necessary to fit the fit_goal_set .

this_job_id

if skip_this_job is false, the fit for this ref:create_job_table@job_table@job_id is ready to be fit and will be fit first. Otherwise, this_job_id is ignored.

all_node_database

all_node_database

node_table

node_table

fit_integrand

fit_integrand

skip_this_job

see this_job_id above.

max_number_cpu

This is the maximum number of cpus (processes) to use. This must be greater than zero. If it is one, the jobs are run sequentially; i.e., not in parallel.

fit_type_list

This is a list with one or two elements and its possible elements are both and fixed. For each job, the first type of fit is attempted. If it fails, and there is a second type of fit, it is attempted. If it also fails, the corresponding job fails.

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’

This is a prior only job and completed by the parent fit

‘wait’

job is waiting for it’s parent job to finish

‘ready’

job is ready to run

‘run’

job is running

‘done’

job finished running

‘error’

job had an exception

‘abort’

job is a descendant of a job that had an exception

shared_job_status_name

This is 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.

number_cpu_inuse

This is the name of the number of cpus in use memory. The corresponding multiprocessing shared memory is a numpy array with dtype equal to int and with length equal to one. The value number_cpu_inuse [0] is the number of cpus (processes) currently fitting this cascade.

shared_lock

is a shared memory lock, used by all the fit processes, that must be acquired to read or write shared memory; i.e., shared_job_status or shared_number_cpu_in_use .

shared_event

is multiprocessing event, used by all the fit processes, that is used to signal that the shared memory has changed.