Skip to content
Snippets Groups Projects
Commit c2c91d3a authored by Ludwig Jaeck's avatar Ludwig Jaeck
Browse files

ISimulation: made jobs stoppable again

parent bd445521
No related branches found
No related tags found
1 merge request!1404ISimulation: made jobs stoppable again
Pipeline #90770 passed
......@@ -87,6 +87,8 @@ JobListView::JobListView(JobModel* jobs, QWidget* parent, Qt::WindowFlags f)
m_listView = new QListView(this);
m_listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_listViewDelegate = new JobListViewDelegate(this);
connect(m_listViewDelegate, &JobListViewDelegate::cancelButtonClicked, this,
&JobListView::onCancel);
m_listView->setItemDelegate(m_listViewDelegate);
layout->addWidget(m_listView);
......
......@@ -216,7 +216,8 @@ void ISimulation::runSingleSimulation(const ReSample& re_sample, size_t batch_st
// Run computation in current thread.
try {
for (size_t i = 0; i < batch_size; ++i)
runComputation(re_sample, batch_start + i, weight);
if (m_progress->alive())
runComputation(re_sample, batch_start + i, weight);
} catch (const std::exception& ex) {
throw std::runtime_error(std::string("Unexpected error in simulation:\n") + ex.what());
}
......@@ -235,7 +236,8 @@ void ISimulation::runSingleSimulation(const ReSample& re_sample, size_t batch_st
&mutex, thread_start, thread_size]() {
try {
for (size_t i = 0; i < thread_size; ++i)
runComputation(re_sample, thread_start + i, weight);
if (m_progress->alive())
runComputation(re_sample, thread_start + i, weight);
} catch (const std::exception& ex) {
mutex.lock();
failure_messages.push_back(ex.what());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment