Skip to content

Commit

Permalink
Rename 'Generated Files' to 'Output Folder' and add relevant check in…
Browse files Browse the repository at this point in the history
… `check_profile`
  • Loading branch information
Leon-Leyang committed Jan 29, 2023
1 parent 3821077 commit ad14623
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 81 deletions.
4 changes: 2 additions & 2 deletions launcher/controllers/docker_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def start_new_cpu_server(self, image, config_file):
source=get_system_path(self.model.profile["paired_path"]),
type="bind"),
docker.types.Mount(target="/Robustar2/generated",
source=get_system_path(self.model.profile["gen_path"]),
source=get_system_path(self.model.profile["out_path"]),
type="bind"),
docker.types.Mount(target="/Robustar2/influence_images",
source=get_system_path(self.model.profile["inf_path"]),
Expand Down Expand Up @@ -238,7 +238,7 @@ def start_new_cuda_server(self, image, config_file):
source=get_system_path(self.model.profile["paired_path"]),
type="bind"),
docker.types.Mount(target="/Robustar2/generated",
source=get_system_path(self.model.profile["gen_path"]),
source=get_system_path(self.model.profile["out_path"]),
type="bind"),
docker.types.Mount(target="/Robustar2/influence_images",
source=get_system_path(self.model.profile["inf_path"]),
Expand Down
20 changes: 15 additions & 5 deletions launcher/controllers/main_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ def set_m_paired_path(self):
if path:
self.model.paired_path = path

def set_m_gen_path(self):
def set_m_out_path(self):
path = QFileDialog.getExistingDirectory(
self.main_view, "Choose Generated Files Path", self.model.cwd
self.main_view, "Choose Output Folder Path", self.model.cwd
)
self.model.cwd = os.path.dirname(path)
if path:
self.model.gen_path = path
self.model.out_path = path

def set_m_ckpt_path(self):
path = QFileDialog.getExistingDirectory(
Expand Down Expand Up @@ -219,8 +219,8 @@ def set_v_test_path(self, val):
def set_v_paired_path(self, val):
self.main_view.ui.paired_line_edit.setText(val)

def set_v_gen_path(self, val):
self.main_view.ui.gen_line_edit.setText(val)
def set_v_out_path(self, val):
self.main_view.ui.out_line_edit.setText(val)

def set_v_ckpt_path(self, val):
self.main_view.ui.ckpt_line_edit.setText(val)
Expand Down Expand Up @@ -277,28 +277,38 @@ def disable_control(self):

def check_profile(self):
miss_profile_dict = {
"name": "container name",
"port": "port",
"train_path": "train set path",
"val_path": "validation set path",
"test_path": "test set path",
"paired_path": "paired set path",
"out_path": "output folder path",
"inf_path": "influence result path",
"ckpt_path": "check point path",
"batch": "batch size",
"worker": "worker number",
"cls": "class number",
"size": "image size",
"device": "device"
}
miss_profile_prompt = []

for profile_name in [
"name",
"port",
"train_path",
"val_path",
"test_path",
"paired_path",
"out_path",
"inf_path",
"ckpt_path",
"batch",
"worker",
"cls",
"size",
"device"
]:
if not self.model.profile[profile_name].strip():
miss_profile_prompt.append(miss_profile_dict[profile_name])
Expand Down
20 changes: 10 additions & 10 deletions launcher/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Model(QObject):
valPathChanged = Signal(str)
testPathChanged = Signal(str)
pairedPathChanged = Signal(str)
genPathChanged = Signal(str)
outPathChanged = Signal(str)
ckptPathChanged = Signal(str)
infPathChanged = Signal(str)
archChanged = Signal(str)
Expand Down Expand Up @@ -38,7 +38,7 @@ def __init__(self, ctrl):
"val_path": "",
"test_path": "",
"paired_path": "",
"gen_path": "",
"out_path": "",
"ckpt_path": "",
"inf_path": "",
"arch": "resnet-18",
Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(self, ctrl):
self.trainPathChanged.connect(self.ctrl.set_v_train_path)
self.valPathChanged.connect(self.ctrl.set_v_val_path)
self.pairedPathChanged.connect(self.ctrl.set_v_paired_path)
self.genPathChanged.connect(self.ctrl.set_v_gen_path)
self.outPathChanged.connect(self.ctrl.set_v_out_path)
self.testPathChanged.connect(self.ctrl.set_v_test_path)
self.ckptPathChanged.connect(self.ctrl.set_v_ckpt_path)
self.infPathChanged.connect(self.ctrl.set_v_inf_path)
Expand Down Expand Up @@ -158,13 +158,13 @@ def paired_path(self, val):
self.pairedPathChanged.emit(val)

@property
def gen_path(self):
return self._profile['gen_path']
def out_path(self):
return self._profile['out_path']

@gen_path.setter
def gen_path(self, val):
self._profile['gen_path'] = val
self.genPathChanged.emit(val)
@out_path.setter
def out_path(self, val):
self._profile['out_path'] = val
self.outPathChanged.emit(val)

@property
def ckpt_path(self):
Expand Down Expand Up @@ -287,7 +287,7 @@ def profile(self, val):
self.val_path = val["val_path"]
self.test_path = val["test_path"]
self.paired_path = val["paired_path"]
self.gen_path = val["gen_path"]
self.out_path = val["out_path"]
self.ckpt_path = val["ckpt_path"]
self.inf_path = val["inf_path"]
self.arch = val["arch"]
Expand Down
42 changes: 21 additions & 21 deletions launcher/resources/launcher_v2.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1368,12 +1368,9 @@ QPushButton:hover {
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="gen_h_layout">
<property name="rightMargin">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="ckpt_h_layout">
<item>
<widget class="QLabel" name="gen_label">
<widget class="QLabel" name="ckpt_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1402,15 +1399,15 @@ QPushButton:hover {
</font>
</property>
<property name="toolTip">
<string>The root path of the generated files</string>
<string>The root path for all checkpoint files saved by Robustar</string>
</property>
<property name="text">
<string>Generated Set</string>
<string>Checkpoint</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="gen_line_edit">
<widget class="QLineEdit" name="ckpt_line_edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1444,7 +1441,7 @@ QPushButton:hover {
</widget>
</item>
<item>
<widget class="QPushButton" name="gen_push_button">
<widget class="QPushButton" name="ckpt_push_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1480,9 +1477,9 @@ QPushButton:hover {
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="ckpt_h_layout">
<layout class="QHBoxLayout" name="inf_h_layout">
<item>
<widget class="QLabel" name="ckpt_label">
<widget class="QLabel" name="inf_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1511,15 +1508,15 @@ QPushButton:hover {
</font>
</property>
<property name="toolTip">
<string>The root path for all checkpoint files saved by Robustar</string>
<string>The root path for all influence result calculated by Robustar</string>
</property>
<property name="text">
<string>Checkpoint</string>
<string>Influence Result</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="ckpt_line_edit">
<widget class="QLineEdit" name="inf_line_edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1553,7 +1550,7 @@ QPushButton:hover {
</widget>
</item>
<item>
<widget class="QPushButton" name="ckpt_push_button">
<widget class="QPushButton" name="inf_push_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1589,9 +1586,12 @@ QPushButton:hover {
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="inf_h_layout">
<layout class="QHBoxLayout" name="out_h_layout">
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="inf_label">
<widget class="QLabel" name="out_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1620,15 +1620,15 @@ QPushButton:hover {
</font>
</property>
<property name="toolTip">
<string>The root path for all influence result calculated by Robustar</string>
<string>The root path of the generated files</string>
</property>
<property name="text">
<string>Influence Result</string>
<string>Output Folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="inf_line_edit">
<widget class="QLineEdit" name="out_line_edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1662,7 +1662,7 @@ QPushButton:hover {
</widget>
</item>
<item>
<widget class="QPushButton" name="inf_push_button">
<widget class="QPushButton" name="out_push_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down
2 changes: 1 addition & 1 deletion launcher/views/main_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, ctrl):
self.ui.val_push_button.clicked.connect(self.ctrl.set_m_val_path)
self.ui.test_push_button.clicked.connect(self.ctrl.set_m_test_path)
self.ui.paired_push_button.clicked.connect(self.ctrl.set_m_paired_path)
self.ui.gen_push_button.clicked.connect(self.ctrl.set_m_gen_path)
self.ui.out_push_button.clicked.connect(self.ctrl.set_m_out_path)
self.ui.ckpt_push_button.clicked.connect(self.ctrl.set_m_ckpt_path)
self.ui.inf_push_button.clicked.connect(self.ctrl.set_m_inf_path)

Expand Down
84 changes: 42 additions & 42 deletions launcher/views/main_view_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,42 +502,6 @@ def setupUi(self, main_widget):

self.data_v_layout.addLayout(self.paired_h_layout)

self.gen_h_layout = QHBoxLayout()
self.gen_h_layout.setObjectName(u"gen_h_layout")
self.gen_h_layout.setContentsMargins(-1, -1, 0, -1)
self.gen_label = QLabel(self.layoutWidget4)
self.gen_label.setObjectName(u"gen_label")
sizePolicy1.setHeightForWidth(self.gen_label.sizePolicy().hasHeightForWidth())
self.gen_label.setSizePolicy(sizePolicy1)
self.gen_label.setMinimumSize(QSize(174, 39))
self.gen_label.setMaximumSize(QSize(174, 39))
self.gen_label.setFont(font)

self.gen_h_layout.addWidget(self.gen_label)

self.gen_line_edit = QLineEdit(self.layoutWidget4)
self.gen_line_edit.setObjectName(u"gen_line_edit")
sizePolicy1.setHeightForWidth(self.gen_line_edit.sizePolicy().hasHeightForWidth())
self.gen_line_edit.setSizePolicy(sizePolicy1)
self.gen_line_edit.setMinimumSize(QSize(137, 24))
self.gen_line_edit.setMaximumSize(QSize(137, 24))
self.gen_line_edit.setFont(font)

self.gen_h_layout.addWidget(self.gen_line_edit)

self.gen_push_button = QPushButton(self.layoutWidget4)
self.gen_push_button.setObjectName(u"gen_push_button")
sizePolicy1.setHeightForWidth(self.gen_push_button.sizePolicy().hasHeightForWidth())
self.gen_push_button.setSizePolicy(sizePolicy1)
self.gen_push_button.setMinimumSize(QSize(28, 20))
self.gen_push_button.setMaximumSize(QSize(28, 20))
self.gen_push_button.setFont(font)

self.gen_h_layout.addWidget(self.gen_push_button)


self.data_v_layout.addLayout(self.gen_h_layout)

self.ckpt_h_layout = QHBoxLayout()
self.ckpt_h_layout.setObjectName(u"ckpt_h_layout")
self.ckpt_label = QLabel(self.layoutWidget4)
Expand Down Expand Up @@ -608,6 +572,42 @@ def setupUi(self, main_widget):

self.data_v_layout.addLayout(self.inf_h_layout)

self.out_h_layout = QHBoxLayout()
self.out_h_layout.setObjectName(u"out_h_layout")
self.out_h_layout.setContentsMargins(-1, -1, 0, -1)
self.out_label = QLabel(self.layoutWidget4)
self.out_label.setObjectName(u"out_label")
sizePolicy1.setHeightForWidth(self.out_label.sizePolicy().hasHeightForWidth())
self.out_label.setSizePolicy(sizePolicy1)
self.out_label.setMinimumSize(QSize(174, 39))
self.out_label.setMaximumSize(QSize(174, 39))
self.out_label.setFont(font)

self.out_h_layout.addWidget(self.out_label)

self.out_line_edit = QLineEdit(self.layoutWidget4)
self.out_line_edit.setObjectName(u"out_line_edit")
sizePolicy1.setHeightForWidth(self.out_line_edit.sizePolicy().hasHeightForWidth())
self.out_line_edit.setSizePolicy(sizePolicy1)
self.out_line_edit.setMinimumSize(QSize(137, 24))
self.out_line_edit.setMaximumSize(QSize(137, 24))
self.out_line_edit.setFont(font)

self.out_h_layout.addWidget(self.out_line_edit)

self.out_push_button = QPushButton(self.layoutWidget4)
self.out_push_button.setObjectName(u"out_push_button")
sizePolicy1.setHeightForWidth(self.out_push_button.sizePolicy().hasHeightForWidth())
self.out_push_button.setSizePolicy(sizePolicy1)
self.out_push_button.setMinimumSize(QSize(28, 20))
self.out_push_button.setMaximumSize(QSize(28, 20))
self.out_push_button.setFont(font)

self.out_h_layout.addWidget(self.out_push_button)


self.data_v_layout.addLayout(self.out_h_layout)


self.docker_data_v_layout.addWidget(self.data_group_box)

Expand Down Expand Up @@ -1083,12 +1083,6 @@ def retranslateUi(self, main_widget):
self.paired_label.setText(QCoreApplication.translate("main_widget", u"Paired Set", None))
self.paired_line_edit.setText("")
self.paired_push_button.setText(QCoreApplication.translate("main_widget", u"...", None))
#if QT_CONFIG(tooltip)
self.gen_label.setToolTip(QCoreApplication.translate("main_widget", u"The root path of the generated files", None))
#endif // QT_CONFIG(tooltip)
self.gen_label.setText(QCoreApplication.translate("main_widget", u"Generated Set", None))
self.gen_line_edit.setText("")
self.gen_push_button.setText(QCoreApplication.translate("main_widget", u"...", None))
#if QT_CONFIG(tooltip)
self.ckpt_label.setToolTip(QCoreApplication.translate("main_widget", u"The root path for all checkpoint files saved by Robustar", None))
#endif // QT_CONFIG(tooltip)
Expand All @@ -1101,6 +1095,12 @@ def retranslateUi(self, main_widget):
self.inf_label.setText(QCoreApplication.translate("main_widget", u"Influence Result", None))
self.inf_line_edit.setText("")
self.inf_push_button.setText(QCoreApplication.translate("main_widget", u"...", None))
#if QT_CONFIG(tooltip)
self.out_label.setToolTip(QCoreApplication.translate("main_widget", u"The root path of the generated files", None))
#endif // QT_CONFIG(tooltip)
self.out_label.setText(QCoreApplication.translate("main_widget", u"Output Folder", None))
self.out_line_edit.setText("")
self.out_push_button.setText(QCoreApplication.translate("main_widget", u"...", None))
self.model_group_box.setTitle(QCoreApplication.translate("main_widget", u"Model", None))
#if QT_CONFIG(tooltip)
self.arch_label.setToolTip(QCoreApplication.translate("main_widget", u"The architecture of the model", None))
Expand Down

0 comments on commit ad14623

Please sign in to comment.