Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions mig/server/grid_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --- BEGIN_HEADER ---
#
# grid_script - the core job handling daemon on a MiG server
# Copyright (C) 2003-2023 The MiG Project lead by Brian Vinter
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
#
# This file is part of MiG.
#
Expand All @@ -20,7 +20,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# -- END_HEADER ---
#
Expand Down Expand Up @@ -163,7 +164,7 @@
% (job['JOB_ID'], total_cputime, delay))
grid_script_msg = 'JOBTIMEOUT %s %s %s\n'\
% (job['UNIQUE_RESOURCE_NAME'], job['EXE'
], job['JOB_ID'])

Check warning on line 167 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
send_message_to_grid_script(grid_script_msg,
logger, configuration)

Expand Down Expand Up @@ -310,29 +311,29 @@
scheduler = FirstFitScheduler(logger, configuration)
elif configuration.sched_alg == 'BestFit':
from mig.server.bestfitscheduler import BestFitScheduler
scheduler = BestFitScheduler(logger, configuration)

Check failure on line 314 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Incompatible types in assignment (expression has type "BestFitScheduler", variable has type "FirstFitScheduler | None") [assignment]
elif configuration.sched_alg == 'FairFit':
from mig.server.fairfitscheduler import FairFitScheduler
scheduler = FairFitScheduler(logger, configuration)

Check failure on line 317 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Incompatible types in assignment (expression has type "FairFitScheduler", variable has type "FirstFitScheduler | None") [assignment]
elif configuration.sched_alg == 'MaxThroughput':
from mig.server.maxthroughputscheduler import MaxThroughputScheduler
scheduler = MaxThroughputScheduler(logger, configuration)

Check failure on line 320 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Incompatible types in assignment (expression has type "MaxThroughputScheduler", variable has type "FirstFitScheduler | None") [assignment]
elif configuration.sched_alg == 'Random':
from mig.server.randomscheduler import RandomScheduler
scheduler = RandomScheduler(logger, configuration)

Check failure on line 323 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Incompatible types in assignment (expression has type "RandomScheduler", variable has type "FirstFitScheduler | None") [assignment]
elif configuration.sched_alg == 'FIFO':
from mig.server.fifoscheduler import FIFOScheduler
scheduler = FIFOScheduler(logger, configuration)

Check failure on line 326 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Incompatible types in assignment (expression has type "FIFOScheduler", variable has type "FirstFitScheduler | None") [assignment]
else:
from mig.server.firstfitscheduler import FirstFitScheduler
print('Unknown sched_alg %s - using FirstFit scheduler'
% configuration.sched_alg)
scheduler = FirstFitScheduler(logger, configuration)

scheduler.attach_job_queue(job_queue)

Check failure on line 333 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Item "None" of "FirstFitScheduler | None" has no attribute "attach_job_queue" [union-attr]
scheduler.attach_done_queue(done_queue)

Check failure on line 334 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Item "None" of "FirstFitScheduler | None" has no attribute "attach_done_queue" [union-attr]
if schedule_cache:
scheduler.set_cache(schedule_cache)

Check failure on line 336 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Item "None" of "FirstFitScheduler | None" has no attribute "set_cache" [union-attr]

# redirect grid_stdin to sys.stdin

Expand Down Expand Up @@ -515,8 +516,8 @@

# Update list of users - create user if new

scheduler.update_users(user_dict)

Check failure on line 519 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Item "None" of "FirstFitScheduler | None" has no attribute "update_users" [union-attr]
user_dict = scheduler.find_user(user_dict)

Check failure on line 520 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Item "None" of "FirstFitScheduler | None" has no attribute "find_user" [union-attr]
user_dict['QUEUE_HIST'].pop(0)
user_dict['QUEUE_HIST'].append(dict_userjob)
scheduler.update_seen(user_dict)
Expand Down Expand Up @@ -693,11 +694,9 @@
exe_job = \
executing_queue.get_job_by_id(job_dict['JOB_ID'
])
# Ignore missing fields
(last_res, last_exe) = ('', '')
if exe_job:

# Ignore missing fields

(last_res, last_exe) = ('', '')
if 'UNIQUE_RESOURCE_NAME' in exe_job:
last_res = exe_job['UNIQUE_RESOURCE_NAME']
if 'EXE' in exe_job:
Expand Down Expand Up @@ -799,7 +798,8 @@

vgrids_in_prioritized_order = []

list_indices = [(last_vgrid + i) % len(exe_vgrids) for i in range(len(exe_vgrids))]
list_indices = [(last_vgrid + i) % len(exe_vgrids)
for i in range(len(exe_vgrids))]
for index in list_indices:

# replace "" with default_vgrid
Expand Down Expand Up @@ -1060,8 +1060,8 @@
mrsl_dict['LOCALJOBNAME'] = localjobname
mrsl_dict['SESSIONID'] = new_job['SESSIONID']
mrsl_dict['IOSESSIONID'] = new_job['IOSESSIONID']
mrsl_dict['MOUNTSSHPUBLICKEY'] = new_job['MOUNTSSHPUBLICKEY']

Check warning on line 1063 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (85 > 80 characters)
mrsl_dict['MOUNTSSHPRIVATEKEY'] = new_job['MOUNTSSHPRIVATEKEY']

Check warning on line 1064 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (87 > 80 characters)

# pickle the new version

Expand Down Expand Up @@ -1131,7 +1131,7 @@
active_job[name] = new_job[name]

executing_queue.enqueue_job(active_job,
executing_queue.queue_length())

Check warning on line 1134 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)

print('executing_queue length %d'
% executing_queue.queue_length())
Expand Down Expand Up @@ -1221,7 +1221,7 @@
pickle(last_request_dict, monitor_last_request_file,
logger)
logger.info('vgrid_name: %s status: %s' % (vgrid_name,
last_request_dict['STATUS']))

Check warning on line 1224 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (88 > 80 characters)
elif vgrid_name in executing_in_other_vgrids:

# create modified last_request_dict and save
Expand All @@ -1230,7 +1230,7 @@
new_last_request_dict['STATUS'] = \
'Executing job for another vgrid'
logger.info('vgrid_name: %s status: %s' % (vgrid_name,
new_last_request_dict['STATUS']))

Check warning on line 1233 in mig/server/grid_script.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (92 > 80 characters)
pickle(new_last_request_dict,
monitor_last_request_file, logger)
else:
Expand Down
16 changes: 14 additions & 2 deletions mig/shared/functionality/autocreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --- BEGIN_HEADER ---
#
# autocreate - auto create user from signed certificate or openid login
# Copyright (C) 2003-2024 The MiG Project lead by Brian Vinter
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
#
# This file is part of MiG.
#
Expand All @@ -20,7 +20,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# -- END_HEADER ---
#
Expand Down Expand Up @@ -214,7 +215,7 @@
output.append({'object_type': 'text', 'text': 'Proxy for %s'
% proxy.GetIdentitySN()})
output.append({'object_type': 'text',
'text': 'Proxy certificate will expire on %s (in %s sec.)'

Check warning on line 218 in mig/shared/functionality/autocreate.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (85 > 80 characters)
% (proxy.Expires(), proxy.getTimeleft())})
except arcwrapper.NoProxyError as err:

Expand Down Expand Up @@ -395,6 +396,11 @@
state = accepted['state'][-1].strip()
org = accepted['org'][-1].strip()
org_unit = ''

# NOTE: no tokens involved here
token_issuer = ''
token_audience = ''

# NOTE: leave role and association alone here
role = ''
association = ''
Expand All @@ -402,7 +408,7 @@
timezone = ''
email = accepted['email'][-1].strip()
if configuration.site_enable_peers:
# Peers are passed as multiple strings of comma or space separated emails

Check warning on line 411 in mig/shared/functionality/autocreate.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (85 > 80 characters)
# so we reformat to a consistently comma+space separated string.
peers_full_name_list = []
for entry in accepted.get('peers_full_name', ['']):
Expand All @@ -429,6 +435,10 @@
org_unit = accepted['openid.sreg.ou'][-1].strip() \
or accepted['openid.sreg.organizational_unit'][-1].strip()

# NOTE: no tokens involved here
token_issuer = ''
token_audience = ''

# We may receive multiple roles and associations

merged = accepted['openid.sreg.role'] + accepted['openid.sreg.roles']
Expand Down Expand Up @@ -469,6 +479,8 @@
# translate to individual args instead in that case. E.g. as in
# 'john@doe.org,jd@doe.org' -> ['john@doe.org', 'jd@doe.org']
email = split_comma_concat(accepted['oidc.claim.email'])[-1].strip()
else:
raise ValueError("Unsupported auth type: %r" % auth_type)

# We may encounter results without an email, fall back to try plain IDs then
if not email:
Expand Down Expand Up @@ -528,9 +540,9 @@
elif auth_type == AUTH_OPENID_CONNECT:
raw_login = identity

if raw_login and not raw_login in openid_names:

Check warning on line 543 in mig/shared/functionality/autocreate.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'
openid_names.append(raw_login)
if email and not email in openid_names:

Check warning on line 545 in mig/shared/functionality/autocreate.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'
openid_names.append(email)
# TODO: Add additional ext oid/oidc provider ID aliases here?

Expand Down
12 changes: 6 additions & 6 deletions mig/shared/mrslparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --- BEGIN_HEADER ---
#
# mrslparser - Parse mRSL job descriptions
# Copyright (C) 2003-2021 The MiG Project lead by Brian Vinter
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
#
# This file is part of MiG.
#
Expand All @@ -20,7 +20,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# -- END_HEADER ---
#
Expand Down Expand Up @@ -136,7 +137,7 @@ def parse(
if not status:
return (False, 'Parse failed (typecheck) %s' % msg)

#logger.debug('check_types updated job dict to: %s' % external_dict)
# logger.debug('check_types updated job dict to: %s' % external_dict)

global_dict = {}

Expand Down Expand Up @@ -375,9 +376,8 @@ def parse(
else:
before_runt_dict = resource_config['RUNTVERIFICATION']
if re_name not in before_runt_dict:
before_runt_dict[re_name] = [].append(dict_entry)
else:
before_runt_dict[re_name].append(dict_entry)
before_runt_dict[re_name] = []
before_runt_dict[re_name].append(dict_entry)

# save dict with added entry

Expand Down