Skip to content

Commit

Permalink
Hotfix: Validate needs to respect machine_id
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneTR committed Jan 5, 2024
1 parent 06045fc commit 3205177
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def do_cleanup(cur_temp, cooldown_time_after_job):
last_cooldown_time = cooldown_time
cooldown_time = 0

if validate.is_validation_needed(client_main['time_between_control_workload_validations']):
if validate.is_validation_needed(config_main['machine']['id'], client_main['time_between_control_workload_validations']):
set_status('measurement_control_start', current_temperature, last_cooldown_time)
validate.run_workload(cwl['name'], cwl['uri'], cwl['filename'], cwl['branch'])
set_status('measurement_control_end', current_temperature, last_cooldown_time)
Expand Down
5 changes: 3 additions & 2 deletions tools/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ def validate_workload_stddev(data, threshold):

return info_string_acc

def is_validation_needed(duration):
def is_validation_needed(machine_id, duration):
query = '''
SELECT id
FROM client_status
WHERE
status_code = 'measurement_control_end'
AND EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - created_at) < %s
AND machine_id = %s
ORDER BY created_at DESC
'''
data = DB().fetch_one(query=query, params=(duration, ))
data = DB().fetch_one(query=query, params=(duration, machine_id))
return data is None or data == []

def handle_validate_exception(exc):
Expand Down

0 comments on commit 3205177

Please sign in to comment.