Skip to content

Commit 47db7e4

Browse files
committed
Ensuring that the portal stuff for instances is NOT parsed if USE_PORTAL is explicitly False.
1 parent a4ad136 commit 47db7e4

1 file changed

Lines changed: 28 additions & 12 deletions

File tree

ipsframework/services.py

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,11 +2392,12 @@ def run_ensemble(
23922392
and their parameters
23932393
"""
23942394

2395-
# This should be a unique variable across all ensembles we keep track of in the portal
2396-
# This ID should only be shared by runs within an ensemble
2395+
# This should be a unique variable across all ensembles we keep track
2396+
# of in the portal This ID should only be shared by runs within an
2397+
# ensemble
23972398
portal_ensemble_id = str(uuid.uuid4())
23982399

2399-
use_portal = self.get_config_param('USE_PORTAL', silent=True) != False # noqa: E712
2400+
use_portal = self.get_config_param('USE_PORTAL', silent=True)
24002401

24012402
def create_driver_config_file(template, working_dir, variables, name):
24022403
"""Create an IPS config file for an ensemble instance
@@ -2419,28 +2420,43 @@ def create_driver_config_file(template, working_dir, variables, name):
24192420
template['_IPS_PORTAL_ENSEMBLE_ID'] = portal_ensemble_id
24202421
template['SIM_NAME'] = name
24212422

2422-
if 'SIM_ROOT' in template and template['SIM_ROOT'] is not None and template['SIM_ROOT'].strip() != '':
2423-
self.info(f'SIM_ROOT in template config assigned a value, {template["SIM_ROOT"]}, that will be ignored')
2423+
if 'SIM_ROOT' in template and \
2424+
template['SIM_ROOT'] is not None and \
2425+
template['SIM_ROOT'].strip() != '':
2426+
self.info(f'SIM_ROOT in template config assigned a value, '
2427+
f'{template["SIM_ROOT"]}, that will be ignored')
24242428

24252429
# Ensure that the instance gets a unique directory for its work
24262430
# by setting SIM_ROOT to the prefix path.
24272431
template['SIM_ROOT'] = Path(working_dir)
24282432

2429-
# Handle portal configuration, note that PORTAL_API_KEY should be an environment variable and will be passed in later.
2433+
# Handle portal configuration, note that PORTAL_API_KEY should be
2434+
# an environment variable and will be passed in later.
24302435
if use_portal:
2431-
# WARNING: portal_runid is set asynchronously by the Portal Bridge, wait for it to be set
2432-
# currently, the value we use in the config file is the value the Bridge component itself generates
2433-
# eventually, would like to rework this so we avoid ever setting this UUID value (and sending it to the portal),
2434-
# only using and sending the actual portal-generated value
2436+
self.debug(f'USE_PORTAL is True, so emitting PORTAL variables.')
2437+
# WARNING: portal_runid is set asynchronously by the Portal
2438+
# Bridge, wait for it to be set currently, the value we use
2439+
# in the config file is the value the Bridge component itself
2440+
# generates eventually, would like to rework this so we avoid
2441+
# ever setting this UUID value (and sending it to the
2442+
# portal), only using and sending the actual portal-generated
2443+
# value
24352444
portal_runid = None
24362445
while portal_runid is None:
2437-
portal_runid = self.get_config_param('PORTAL_RUNID', silent=True)
2438-
portal_url = self.get_config_param('PORTAL_URL', silent=True)
2446+
self.debug('Attempting to get portal run ID')
2447+
portal_runid = self.get_config_param('PORTAL_RUNID',
2448+
silent=True)
2449+
self.debug(f'Using portal run ID: {portal_runid}')
2450+
2451+
portal_url = self.get_config_param('PORTAL_URL',
2452+
silent=True)
24392453

24402454
template['PORTAL_URL'] = portal_url
24412455
template['USE_PORTAL'] = 'True'
24422456
template['PARENT_PORTAL_RUNID'] = portal_runid
24432457
else:
2458+
self.debug('USE_PORTAL is False, so propagating that to '
2459+
'ensemble instance config file.')
24442460
template['USE_PORTAL'] = 'False'
24452461

24462462
# We need to plug in the variables, so we need to find the section

0 commit comments

Comments
 (0)