Skip to content

Commit 690c7bc

Browse files
committed
Fix a couple of pylint warnings like
`E0606: Possibly using variable 'last_res' before assignment (possibly-used-before-assignment)` by moving init up above conditional.
1 parent eca6689 commit 690c7bc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mig/server/grid_script.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# grid_script - the core job handling daemon on a MiG server
7-
# Copyright (C) 2003-2023 The MiG Project lead by Brian Vinter
7+
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
88
#
99
# This file is part of MiG.
1010
#
@@ -20,7 +20,8 @@
2020
#
2121
# You should have received a copy of the GNU General Public License
2222
# along with this program; if not, write to the Free Software
23-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24+
# USA.
2425
#
2526
# -- END_HEADER ---
2627
#
@@ -693,11 +694,9 @@ def graceful_shutdown():
693694
exe_job = \
694695
executing_queue.get_job_by_id(job_dict['JOB_ID'
695696
])
697+
# Ignore missing fields
698+
(last_res, last_exe) = ('', '')
696699
if exe_job:
697-
698-
# Ignore missing fields
699-
700-
(last_res, last_exe) = ('', '')
701700
if 'UNIQUE_RESOURCE_NAME' in exe_job:
702701
last_res = exe_job['UNIQUE_RESOURCE_NAME']
703702
if 'EXE' in exe_job:
@@ -799,7 +798,8 @@ def graceful_shutdown():
799798

800799
vgrids_in_prioritized_order = []
801800

802-
list_indices = [(last_vgrid + i) % len(exe_vgrids) for i in range(len(exe_vgrids))]
801+
list_indices = [(last_vgrid + i) % len(exe_vgrids)
802+
for i in range(len(exe_vgrids))]
803803
for index in list_indices:
804804

805805
# replace "" with default_vgrid

0 commit comments

Comments
 (0)