Skip to content

Commit b69b26d

Browse files
committed
Pep8 compliance
1 parent 1218e2a commit b69b26d

File tree

2 files changed

+9
-43
lines changed

2 files changed

+9
-43
lines changed

payu/models/staged_cable.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, expt, name, config):
3232

3333
# We want people to be able to use payu during testing, which
3434
# often means additions of new namelists due to new science
35-
# modules. I would like to set
35+
# modules. I would like to set
3636
# optional_config_files = glob.glob("*.nml")
3737
# but this feels like a bit of an abuse of feature.
3838
self.config_files = ['stage_config.yaml']
@@ -128,39 +128,6 @@ def _prepare_configuration(self):
128128
# Finish handling of single step stage
129129
return cable_stages
130130

131-
def _get_further_restarts(self):
132-
"""Get the restarts from stages further in the past where necessary."""
133-
134-
# Often we take restarts from runs which are not the most recent run as
135-
# inputs for particular science modules, which means we have to extend
136-
# the existing functionality around retrieving restarts.
137-
138-
# We can't supercede the parent get_prior_restart_files, since the
139-
# files returned by said function are prepended by
140-
# self.prior_restart_path, which is not desirable in this instance.
141-
142-
num_completed_stages = len(self.configuration_log['completed_stages'])
143-
144-
for stage_number in reversed(range(num_completed_stages - 1)):
145-
respath = os.path.join(
146-
self.expt.archive_path,
147-
f'restart{stage_number:03d}'
148-
)
149-
for f_name in os.listdir(respath):
150-
if os.path.isfile(os.path.join(respath, f_name)):
151-
f_orig = os.path.join(respath, f_name)
152-
f_link = os.path.join(self.work_init_path_local, f_name)
153-
# Check whether a given link already exists in the
154-
# manifest, so we don't write over a newer version of a
155-
# restart
156-
if f_link not in self.expt.manifest.manifests['restart']:
157-
self.expt.manifest.add_filepath(
158-
'restart',
159-
f_link,
160-
f_orig,
161-
self.copy_restarts
162-
)
163-
164131
def set_model_pathnames(self):
165132
super(StagedCable, self).set_model_pathnames()
166133

@@ -228,7 +195,7 @@ def _set_current_stage(self):
228195
slot, then copy the configuration log to the working directory."""
229196

230197
self.configuration_log['current_stage'] = \
231-
self.configuration_log['queued_stages'].pop(0)
198+
self.configuration_log['queued_stages'].pop(0)
232199

233200
self._save_configuration_log()
234201
conf_log_p = os.path.join(self.control_path, 'configuration_log.yaml')
@@ -277,8 +244,7 @@ def _collect_restarts(self):
277244
for f in os.listdir(prior_restart_path):
278245
if f not in generated_restarts:
279246
shutil.copy(os.path.join(prior_restart_path, f),
280-
self.work_restart_path)
281-
247+
self.work_restart_path)
282248

283249
# Move the files in work_path/restart first
284250
for f in os.listdir(self.work_restart_path):

test/models/test_staged_cable.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_staged_cable():
131131

132132
# Since we've called the initialiser, we should be able to inspect the
133133
# stages immediately (through the configuration log)
134-
expected_queued_stages = [
134+
expected_q_stages = [
135135
'stage_2',
136136
'stage_3',
137137
'stage_4',
@@ -141,7 +141,7 @@ def test_staged_cable():
141141
'stage_6',
142142
'stage_6',
143143
'stage_7']
144-
assert model.configuration_log['queued_stages'] == expected_queued_stages
144+
assert model.configuration_log['queued_stages'] == expected_q_stages
145145
assert model.configuration_log['current_stage'] == 'stage_1'
146146

147147
# Now check the namelist
@@ -165,7 +165,7 @@ def test_staged_cable():
165165

166166
# Archive the stage and make sure the configuration log is correct
167167
model.archive()
168-
expected_comp_stages = ['stage_1']
169-
expected_current_stage = ''
170-
assert model.configuration_log['completed_stages'] == expected_comp_stages
171-
assert model.configuration_log['current_stage'] == expected_current_stage
168+
ex_comp_stages = ['stage_1']
169+
ex_curr_stage = ''
170+
assert model.configuration_log['completed_stages'] == ex_comp_stages
171+
assert model.configuration_log['current_stage'] == ex_curr_stage

0 commit comments

Comments
 (0)