Skip to content

Commit

Permalink
enable user-friendly strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bennybp committed Jan 8, 2025
1 parent bc6ff27 commit 4bbe0df
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion qcfractalcompute/qcfractalcompute/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _check_logfile(cls, v, values):
def _check_run_dir(cls, v, values):
return _make_abs_path(v, values["base_folder"], "parsl_run_dir")

@validator("update_frequency", pre=True)
@validator("update_frequency", "max_idle_time", pre=True)
def _convert_durations(cls, v):
return duration_to_seconds(v)

Expand Down
8 changes: 8 additions & 0 deletions qcfractalcompute/qcfractalcompute/test_manager_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,25 @@ def test_manager_config_durations(tmp_path):
base_config = copy.deepcopy(_base_config)

base_config["update_frequency"] = "900"
base_config["max_idle_time"] = "3600"
manager_config = FractalComputeConfig(base_folder=base_folder, **base_config)
assert manager_config.update_frequency == 900
assert manager_config.max_idle_time == 3600

base_config["update_frequency"] = 900
base_config["max_idle_time"] = 3600
manager_config = FractalComputeConfig(base_folder=base_folder, **base_config)
assert manager_config.update_frequency == 900
assert manager_config.max_idle_time == 3600

base_config["update_frequency"] = "3d4h80m09s"
base_config["max_idle_time"] = "1d8h99m77s"
manager_config = FractalComputeConfig(base_folder=base_folder, **base_config)
assert manager_config.update_frequency == 278409
assert manager_config.max_idle_time == 121217

base_config["update_frequency"] = "3:04:80:9"
base_config["max_idle_time"] = "1:8:99:77"
manager_config = FractalComputeConfig(base_folder=base_folder, **base_config)
assert manager_config.update_frequency == 278409
assert manager_config.max_idle_time == 121217
9 changes: 4 additions & 5 deletions qcfractalcompute/qcfractalcompute/testing_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@

failed_op = FailedOperation(
input_data=None,
error={
'error_type': 'internal_error',
'error_message': 'This is a test error message'
},
error={"error_type": "internal_error", "error_message": "This is a test error message"},
)


Expand Down Expand Up @@ -108,7 +105,9 @@ def _mock_app(result: Optional[AllResultTypes]) -> AppTaskResult:
if result is None:
return AppTaskResult(success=False, walltime=2.0, result_compressed=compress_result(failed_op.dict()))
else:
return AppTaskResult(success=result.success, walltime=2.0, result_compressed=compress_result(result.dict()))
return AppTaskResult(
success=result.success, walltime=2.0, result_compressed=compress_result(result.dict())
)

for task in tasks:
self._record_id_map[task.id] = task.record_id
Expand Down

0 comments on commit 4bbe0df

Please sign in to comment.