Skip to content

Commit

Permalink
be less strict when comparing versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dionhaefner committed Oct 10, 2019
1 parent 68927fa commit 9aca05d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion fowd/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ def qc_format(flags_fired, t, z, wave_period, crest_height, trough_depth):
)


def is_same_version(version1, version2):
split_v1 = version1.split('.')
split_v2 = version2.split('.')

if len(split_v1) < 2 or len(split_v2) < 2:
# unexpected format
return False

# only compare major and minor version
return split_v1[:2] == split_v2[2:]


def initialize_processing(record_file, state_file, input_hash):
"""Parse temporary files to re-start processing if possible"""
default_params = dict(
Expand All @@ -90,7 +102,8 @@ def initialize_processing(record_file, state_file, input_hash):
if saved_state['input_hash'] != input_hash:
raise RuntimeError('Input hash has changed')

if saved_state['processing_version'] != get_proc_version():
this_version = get_proc_version()
if not is_same_version(saved_state['processing_version'], this_version):
raise RuntimeError('Processing version has changed')

for row in read_pickled_records(record_file):
Expand Down

0 comments on commit 9aca05d

Please sign in to comment.