BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The JobQueueData class holds all objects/logic to run simulation in a thread.
Definition at line 28 of file JobQueueData.h.
Public Slots | |
void | cancelJob (const QString &identifier) |
Cancels running job. More... | |
void | onCancelAllJobs () |
Cancels all running jobs. More... | |
void | onFinishedJob () |
Performs necessary actions when job is finished. More... | |
void | onFinishedThread () |
void | onProgressUpdate () |
void | onStartedJob () |
Sets JobItem properties when the job is going to start. More... | |
void | removeJob (const QString &identifier) |
Remove job from list completely. More... | |
void | runJob (JobItem *jobItem) |
Submits job and run it in a thread. More... | |
Signals | |
void | focusRequest (JobItem *jobItem) |
void | globalProgress (int) |
Public Member Functions | |
JobQueueData (JobModel *jobModel) | |
bool | hasUnfinishedJobs () |
Private Member Functions | |
void | assignForDeletion (JobWorker *worker) |
Removes JobRunner from the map of known runners, assigns it for deletion. More... | |
void | assignForDeletion (QThread *thread) |
Removes QThread from the map of known threads, assigns it for deletion. More... | |
void | clearSimulation (const QString &identifier) |
ISimulation * | getSimulation (const QString &identifier) |
Returns the simulation (if exists) for given identifier. More... | |
QThread * | getThread (const QString &identifier) |
Returns the thread for given identifier. More... | |
JobWorker * | getWorker (const QString &identifier) |
Returns job runner for given identifier. More... | |
void | processFinishedJob (JobWorker *worker, JobItem *jobItem) |
Set all data of finished job. More... | |
void | updateGlobalProgress () |
Estimates global progress from the progress of multiple running jobs and emits appropriate signal. More... | |
Private Attributes | |
JobModel * | m_jobModel |
job identifier to simulation More... | |
QMap< QString, ISimulation * > | m_simulations |
job identifier to jobWorker More... | |
QMap< QString, QThread * > | m_threads |
QMap< QString, JobWorker * > | m_workers |
job identifier to the thread More... | |
JobQueueData::JobQueueData | ( | JobModel * | jobModel | ) |
Definition at line 26 of file JobQueueData.cpp.
|
private |
Removes JobRunner from the map of known runners, assigns it for deletion.
Definition at line 197 of file JobQueueData.cpp.
|
private |
Removes QThread from the map of known threads, assigns it for deletion.
Definition at line 182 of file JobQueueData.cpp.
References Error, and m_threads.
Referenced by onFinishedJob(), and onFinishedThread().
|
slot |
Cancels running job.
Definition at line 88 of file JobQueueData.cpp.
References getThread(), getWorker(), and JobWorker::terminate().
Referenced by JobModel::cancelJob(), onCancelAllJobs(), and removeJob().
|
private |
Definition at line 212 of file JobQueueData.cpp.
References getSimulation(), and m_simulations.
Referenced by onFinishedJob(), and removeJob().
|
signal |
Referenced by JobModel::JobModel(), onFinishedJob(), and runJob().
|
private |
Returns the simulation (if exists) for given identifier.
Definition at line 257 of file JobQueueData.cpp.
References m_simulations.
Referenced by clearSimulation(), and runJob().
|
private |
Returns the thread for given identifier.
Definition at line 241 of file JobQueueData.cpp.
References m_threads.
Referenced by cancelJob(), onFinishedJob(), and runJob().
|
private |
Returns job runner for given identifier.
Definition at line 249 of file JobQueueData.cpp.
References m_workers.
Referenced by cancelJob().
|
signal |
Referenced by JobModel::JobModel(), onFinishedJob(), and updateGlobalProgress().
bool JobQueueData::hasUnfinishedJobs | ( | ) |
Definition at line 31 of file JobQueueData.cpp.
References m_simulations.
Referenced by JobModel::hasUnfinishedJobs(), and onFinishedJob().
|
slot |
Cancels all running jobs.
Definition at line 174 of file JobQueueData.cpp.
References cancelJob(), and m_threads.
|
slot |
Performs necessary actions when job is finished.
Definition at line 117 of file JobQueueData.cpp.
References assignForDeletion(), clearSimulation(), focusRequest(), JobModel::getJobItemForIdentifier(), getThread(), globalProgress(), hasUnfinishedJobs(), m_jobModel, and processFinishedJob().
Referenced by runJob().
|
slot |
Definition at line 137 of file JobQueueData.cpp.
References assignForDeletion().
Referenced by runJob().
|
slot |
Definition at line 143 of file JobQueueData.cpp.
References JobModel::getJobItemForIdentifier(), m_jobModel, JobItem::setProgress(), and updateGlobalProgress().
Referenced by runJob().
|
slot |
Sets JobItem properties when the job is going to start.
Definition at line 104 of file JobQueueData.cpp.
References JobModel::getJobItemForIdentifier(), m_jobModel, Running, and JobItem::setProgress().
Referenced by runJob().
Set all data of finished job.
Definition at line 221 of file JobQueueData.cpp.
References Failed, JobWorker::failureMessage(), JobItem::isCompleted(), JobWorker::result(), JobItem::setComments(), JobItem::setEndTime(), JobItem::setProgress(), JobItem::setResults(), JobItem::setStatus(), JobWorker::simulationEnd(), and JobWorker::status().
Referenced by onFinishedJob().
|
slot |
Remove job from list completely.
Definition at line 96 of file JobQueueData.cpp.
References cancelJob(), and clearSimulation().
Referenced by JobModel::removeJob().
|
slot |
Submits job and run it in a thread.
Definition at line 38 of file JobQueueData.cpp.
References Error, Failed, JobWorker::finished(), focusRequest(), JobItem::getIdentifier(), getSimulation(), getThread(), JobItem::instrumentItem(), GUI::Transform::ToCore::itemsToSimulation(), m_simulations, m_threads, m_workers, onFinishedJob(), onFinishedThread(), onProgressUpdate(), onStartedJob(), JobWorker::progressUpdate(), JobItem::sampleItem(), JobItem::setComments(), JobItem::setProgress(), JobItem::setStatus(), JobItem::simulationOptionsItem(), JobWorker::start(), and JobWorker::started().
Referenced by JobModel::runJob().
|
private |
Estimates global progress from the progress of multiple running jobs and emits appropriate signal.
Definition at line 154 of file JobQueueData.cpp.
References globalProgress(), JobModel::jobItems(), and m_jobModel.
Referenced by onProgressUpdate().
|
private |
job identifier to simulation
Definition at line 67 of file JobQueueData.h.
Referenced by onFinishedJob(), onProgressUpdate(), onStartedJob(), and updateGlobalProgress().
|
private |
job identifier to jobWorker
Definition at line 65 of file JobQueueData.h.
Referenced by clearSimulation(), getSimulation(), hasUnfinishedJobs(), and runJob().
|
private |
Definition at line 63 of file JobQueueData.h.
Referenced by assignForDeletion(), getThread(), onCancelAllJobs(), and runJob().
|
private |
job identifier to the thread
Definition at line 64 of file JobQueueData.h.
Referenced by assignForDeletion(), getWorker(), and runJob().