FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit b3f4c621 authored by L. Bower's avatar L. Bower
Browse files

updating comments

parent 8e6db619
No related branches found
No related tags found
No related merge requests found
...@@ -12,8 +12,8 @@ class Jobstatus: ...@@ -12,8 +12,8 @@ class Jobstatus:
Context manager to determine and change status of a job based on status file Context manager to determine and change status of a job based on status file
in a given directory. in a given directory.
Only possible status values are 'SUCCESS', 'INPROGRESS', 'HELD', 'WARNING' Only possible status values are 'SUCCESS', 'INPROGRESS', 'HELD', 'WARNING',
and 'ERROR'. 'SUCCESS_WITH_WARNING', 'SUCCESS_WITH_ERROR' and 'ERROR'.
Use jobStatus.reset(status) to change the current status file. Use jobStatus.reset(status) to change the current status file.
......
...@@ -127,6 +127,17 @@ def open_and_check_config(configFile) -> dict: ...@@ -127,6 +127,17 @@ def open_and_check_config(configFile) -> dict:
def parse_json_file_with_tokens(file_path: str, tokens: dict = None) -> dict: def parse_json_file_with_tokens(file_path: str, tokens: dict = None) -> dict:
"""
parses a json file, replacing any tokens with values from the tokens dict. Tokens are marked as ${token_name} in the
json file. The tokens dict should be a dictionary of key value pairs where the key is the token and the value is the
value to replace the token with. This function can be called with None for the tokens argument, resulting in a simple
json file parse.
:param file_path:
:param tokens:
:return:
"""
with open(file_path, 'r') as file: with open(file_path, 'r') as file:
file_string: str = file.read() file_string: str = file.read()
file.seek(0) # reset the index to read again file.seek(0) # reset the index to read again
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment