Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow APP to differ between RUNs #2943

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from

Conversation

DavidHuber-NOAA
Copy link
Contributor

@DavidHuber-NOAA DavidHuber-NOAA commented Sep 19, 2024

Description

This enables APP to be specified for each RUN. This also removes the need for a _no_run configuration dictionary and somewhat simplifies the _init_finalize method.

Resolves #2908

Type of change

  • New feature (adds functionality)

Change characteristics

  • Is this a breaking change (a change in existing functionality)? NO
  • Does this change require a documentation update? NO
  • Does this change require an update to any submodules? NO

How has this been tested?

  • Generated .xml files on Hera for all available CI tests and verified they were identical to develop.
  • Created an arbitrary APP configuration ({"gdas": "S2S", "gfs": "ATM"})

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass with my changes

@DavidHuber-NOAA
Copy link
Contributor Author

This is going to require some more leg work as some APP-specific flags are currently read in without specifying a RUN:

base = conf.parse_config('config.base')
self.mode = base['MODE']
if self.mode not in self.VALID_MODES:
raise NotImplementedError(f'{self.mode} is not a valid application mode.\n'
f'Valid application modes are:\n'
f'{", ".join(self.VALID_MODES)}\n')
self.net = base['NET']
self.model_app = base.get('APP', 'ATM')
self.do_atm = base.get('DO_ATM', True)
self.do_wave = base.get('DO_WAVE', False)
self.do_wave_bnd = base.get('DOBNDPNT_WAVE', False)
self.do_ocean = base.get('DO_OCN', False)
self.do_ice = base.get('DO_ICE', False)
self.do_aero = base.get('DO_AERO', False)

This will require reworking the get_task_names methods to key off of RUN-specific flags.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WalterKolczynski-NOAA I have made some significant changes to the Application classes to allow the APP to vary by RUN. Next, I will need to update the Rocoto class to work with this modified class. Before I start that, could you take a look at these and see if you're OK with what I have done. Happy to meet to go over details if needed.

@DavidHuber-NOAA
Copy link
Contributor Author

This PR now correctly generates identical CI XMLs as compared to develop (with the exception of the stage_ic and cleanup jobs which are now run on service partitions). An additional case was tested based on the C96C48_hybatmaerosnowDA case, but the APP was set to ATMA for RUN==gdas and ATM for RUN==gfs. In this case, the gfs tasks in the resultant XML did not include any aero-component jobs.

Marking ready for review.

Comment on lines +120 to +135
if run_options[run]['do_aero']:
aero_anl_run = run_base.get('AERO_ANL_RUN', 'BOTH').lower()
if aero_anl_run in ['both']:
aero_anl_runs = ['gfs', 'gdas']
elif aero_anl_run in ['gfs', 'gdas']:
aero_anl_runs = [aero_anl_run]

aero_fcst_run = run_base.get('AERO_FCST_RUN', None).lower()
if aero_fcst_run in ['both']:
aero_fcst_runs = ['gfs', 'gdas']
elif aero_fcst_run in ['gfs', 'gdas']:
aero_fcst_runs = [aero_fcst_run]

run_options[run]['do_aero_anl'] = True if run in aero_anl_runs else False
run_options[run]['do_aero_fcst'] = True if run in aero_fcst_runs else False

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic can be redesigned in config.base so that, e.g. do_aero_anl would be set based on RUN, making the Python logic simpler and making it easier for developers to modify. There are some other places I will tag that should be moveable as well. Should this be done as part of this PR or could it wait for a future issue?

Comment on lines +191 to +203
if run == 'gdas':
if not options['do_jediatmvar']:
task_names[run] += ['analdiag']

if options['do_wave'] and run in self.wave_runs:
task_names[run] += wave_prep_tasks

if options['do_aero'] and run in options['aero_anl_runs']:
task_names[run] += ['aeroanlgenb']

else:
if options['do_wave'] and run in self.wave_runs:
task_names[run] += wave_prep_tasks
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could be made into RUN-specific options in config.base.

Comment on lines +108 to +114
wave_runs = []
if run_options[run]['do_wave']:
wave_run = run_base.get('WAVE_RUN', 'BOTH').lower()
if wave_run in ['both']:
wave_runs = ['gfs', 'gdas']
elif wave_run in ['gfs', 'gdas']:
wave_runs = [wave_run]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be handled in config.base so do_wave is set based on RUN.

if options['do_wave'] and run in self.wave_runs:
task_names[run] += wave_prep_tasks

if options['do_aero'] and run in options['aero_anl_runs']:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do_aero could be set in config.base based on RUN.

if options['do_metp']:
task_names[run] += ['metp']

if options['do_wave'] and run in options['wave_runs']:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do_wave could be set in config.base based on RUN.

Comment on lines +102 to 106
if options['do_aero']:
aero_fcst_run = options['aero_fcst_run']
if self.run in aero_fcst_run or aero_fcst_run == "both":
if not self.exp_warm_start:
if not options['exp_warm_start']:
tasks += ['aerosol_init']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do_aero_fcst could be set in config.base based on RUN.

if self.app_config.do_aero and \
self.run in self.app_config.aero_fcst_runs and \
if self.options['do_aero'] and \
self.run in self.options['aero_fcst_runs'] and \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do_aero_fcst could be set in config.base based on RUN.

dep_dict = {'type': 'task', 'name': f'{self.run}marineanlfinal'}
dependencies.append(rocoto.add_dependency(dep_dict))

if self.app_config.do_aero and self.run in self.app_config.aero_anl_runs:
if self.options['do_aero'] and self.run in self.options['aero_anl_runs']:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do_aero_anl could be set in config.base based on RUN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable RUN-specific APP configurations
1 participant