if (batch_params.maximum_duration == "")
{
+ setField("default_time", true);
setField("duration_hour", 0);
setField("duration_min", 0);
}
else
{
+ setField("user_time", true);
std::size_t pos = batch_params.maximum_duration.find(":");
std::string hour_str = batch_params.maximum_duration.substr(0, pos);
int hour;
setField("duration_min", min);
}
- unsigned long long mem_mb = batch_params.mem_limit;
- if (mem_mb % 1024 == 0)
+ long long mem_mb = batch_params.mem_limit;
+ if (mem_mb < 1)
{
- setField("mem_value", mem_mb / 1024);
- _batch_parameters_page->setMemUnit(BatchParametersPage::GB);
+ setField("default_mem", true);
}
else
{
- setField("mem_value", mem_mb);
- _batch_parameters_page->setMemUnit(BatchParametersPage::MB);
+ setField("user_mem", true);
+ if (mem_mb % 1024 == 0)
+ {
+ setField("mem_value", mem_mb / 1024);
+ _batch_parameters_page->setMemUnit(BatchParametersPage::GB);
+ }
+ else
+ {
+ setField("mem_value", mem_mb);
+ _batch_parameters_page->setMemUnit(BatchParametersPage::MB);
+ }
+ _batch_parameters_page->setMemReqType(batch_params.mem_req_type);
}
- _batch_parameters_page->setMemReqType(batch_params.mem_req_type);
BL::Job::FilesParam files_params = job->getFilesParameters();
QString time_hour;
QString time_min;
- if(field("duration_hour").toInt() == 0 && field("duration_min").toInt() == 0)
+ if (field("default_time").toBool() ||
+ (field("duration_hour").toInt() == 0 && field("duration_min").toInt() == 0))
{
maximum_duration = "";
}
maximum_duration = time_hour.toStdString() + ":" + time_min.toStdString();
}
- unsigned long mem = field("mem_value").toULongLong();
- BatchParametersPage::MemUnit mem_unit = _batch_parameters_page->getMemUnit();
- switch (mem_unit)
+ if(field("default_mem").toBool())
{
- case BatchParametersPage::MB:
- mem_limit = mem;
- break;
- case BatchParametersPage::GB:
- mem_limit = mem * 1024;
- break;
- default:
- throw Exception("Invalid memory unit");
+ mem_limit = -1;
+ }
+ else
+ {
+ unsigned long mem = field("mem_value").toULongLong();
+ BatchParametersPage::MemUnit mem_unit = _batch_parameters_page->getMemUnit();
+ switch (mem_unit)
+ {
+ case BatchParametersPage::MB:
+ mem_limit = mem;
+ break;
+ case BatchParametersPage::GB:
+ mem_limit = mem * 1024;
+ break;
+ default:
+ throw Exception("Invalid memory unit");
+ }
+ mem_req_type = _batch_parameters_page->getMemReqType();
}
- mem_req_type = _batch_parameters_page->getMemReqType();
nb_proc = field("proc_value").toInt();
exclusive = field("exclusive").toBool();
registerField("mem_value", ui->spin_memory);
registerField("proc_value", ui->spin_proc);
registerField("exclusive", ui->check_exclusive);
+ registerField("default_time", ui->rb_default_time);
+ registerField("user_time", ui->rb_user_time);
+ registerField("default_mem", ui->rb_default_mem);
+ registerField("user_mem", ui->rb_user_mem);
ui->combo_memory_unit->insertItem(ui->combo_memory_unit->count(), "MB", MB);
ui->combo_memory_unit->insertItem(ui->combo_memory_unit->count(), "GB", GB);
"per node", Job::MEM_PER_NODE);
ui->combo_memory_req_type->insertItem(ui->combo_memory_req_type->count(),
"per core", Job::MEM_PER_CPU);
+
+ connect(ui->spin_duration_hour, SIGNAL(valueChanged(int)), this, SLOT(timeChanged()));
+ connect(ui->spin_duration_min, SIGNAL(valueChanged(int)), this, SLOT(timeChanged()));
+ connect(ui->spin_memory, SIGNAL(valueChanged(int)), this, SLOT(memChanged()));
+ connect(ui->combo_memory_unit, SIGNAL(currentIndexChanged(int)), this, SLOT(memChanged()));
+ connect(ui->combo_memory_req_type, SIGNAL(currentIndexChanged(int)), this, SLOT(memChanged()));
};
BatchParametersPage::~BatchParametersPage()
ui->combo_memory_req_type->setCurrentIndex(ui->combo_memory_req_type->findData(mem_req_type));
}
+void
+BatchParametersPage::timeChanged()
+{
+ if (ui->spin_duration_hour->value() == 0 && ui->spin_duration_min->value() == 0)
+ ui->rb_default_time->setChecked(true);
+ else
+ ui->rb_user_time->setChecked(true);
+}
+
+void
+BatchParametersPage::memChanged()
+{
+ ui->rb_user_mem->setChecked(true);
+}
+
void
BatchParametersPage::cleanupPage()
{
QLabel * job_mdt_label = new QLabel("Maximum duration:");
_job_mdt_label_value = new QLabel("");
- QLabel * job_em_label = new QLabel("Expected memory:");
- _job_em_label_value = new QLabel("");
+ QLabel * job_req_mem_label = new QLabel("Required memory:");
+ _job_req_mem_label_value = new QLabel("");
QLabel * job_nop_label = new QLabel("Number of processors:");
_job_nop_label_value = new QLabel("");
QLabel * job_excl_label = new QLabel("Exclusive:");
_other_run_values_form = new QFormLayout;
_other_run_values_form->insertRow(0, job_mdt_label, _job_mdt_label_value);
- _other_run_values_form->insertRow(1, job_em_label, _job_em_label_value);
+ _other_run_values_form->insertRow(1, job_req_mem_label, _job_req_mem_label_value);
_other_run_values_form->insertRow(2, job_nop_label, _job_nop_label_value);
_other_run_values_form->insertRow(3, job_excl_label, _job_excl_label_value);
_job_bd_label_value->setText(QString::fromUtf8(batch_params.batch_directory.c_str()));
_job_rd_label_value->setText(QString::fromUtf8(files_params.result_directory.c_str()));
- _job_mdt_label_value->setText(QString(batch_params.maximum_duration.c_str()));
+ QString time = (batch_params.maximum_duration == "")? "Default" :
+ batch_params.maximum_duration.c_str();
+ _job_mdt_label_value->setText(time);
_job_nop_label_value->setText(QVariant(batch_params.nb_proc).toString());
QString exclText = (batch_params.exclusive)? "yes" : "no";
_job_excl_label_value->setText(exclText);
// Memory requirement
- unsigned long long mem_mb = batch_params.mem_limit;
+ long mem_mb = batch_params.mem_limit;
ostringstream mem_ss;
- if (mem_mb % 1024 == 0)
- mem_ss << mem_mb / 1024 << "GB";
+ if (mem_mb < 1)
+ mem_ss << "Default";
else
- mem_ss << mem_mb << "MB";
- switch (batch_params.mem_req_type)
{
- case BL::Job::MEM_PER_NODE:
- mem_ss << " per node";
- break;
- case BL::Job::MEM_PER_CPU:
- mem_ss << " per core";
- break;
- default:
- throw Exception("Unknown memory requirement, unable to show selected job");
+ if (mem_mb % 1024 == 0)
+ mem_ss << mem_mb / 1024 << "GB";
+ else
+ mem_ss << mem_mb << "MB";
+ switch (batch_params.mem_req_type)
+ {
+ case BL::Job::MEM_PER_NODE:
+ mem_ss << " per node";
+ break;
+ case BL::Job::MEM_PER_CPU:
+ mem_ss << " per core";
+ break;
+ default:
+ throw Exception("Unknown memory requirement, unable to show selected job");
+ }
}
- _job_em_label_value->setText(QString(mem_ss.str().c_str()));
+ _job_req_mem_label_value->setText(QString(mem_ss.str().c_str()));
// Parameters for COORM
_job_lf_label_value->setText(QString::fromUtf8(batch_params.launcher_file.c_str()));
_job_bd_label_value->setText("");
_job_rd_label_value->setText("");
_job_mdt_label_value->setText("");
- _job_em_label_value->setText("");
+ _job_req_mem_label_value->setText("");
_job_nop_label_value->setText("");
_job_excl_label_value->setText("");
_job_jobfile_label_value->setText("");
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QRadioButton" name="radioButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
+ <widget class="QRadioButton" name="rb_default_time">
<property name="text">
<string>Default</string>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QRadioButton" name="radioButton_2">
+ <widget class="QRadioButton" name="rb_user_time">
<property name="text">
<string/>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
- <widget class="QRadioButton" name="radioButton_3">
- <property name="enabled">
- <bool>false</bool>
- </property>
+ <widget class="QRadioButton" name="rb_default_mem">
<property name="text">
<string>Default</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
<attribute name="buttonGroup">
<string notr="true">memoryButtonGroup</string>
</attribute>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
- <widget class="QRadioButton" name="radioButton_4">
+ <widget class="QRadioButton" name="rb_user_mem">
<property name="text">
<string/>
</property>
- <property name="checked">
- <bool>true</bool>
- </property>
<attribute name="buttonGroup">
<string notr="true">memoryButtonGroup</string>
</attribute>