added time to all events. this is a unix timestamp so will need to be converted to something nicer if dispalyed, but hey, its easy to store

This commit is contained in:
PatchOfScotland
2023-04-27 15:13:47 +02:00
parent d3eb2dbf9f
commit 933d568fb2
13 changed files with 210 additions and 143 deletions

View File

@ -13,11 +13,10 @@ from meow_base.core.base_recipe import BaseRecipe
from meow_base.core.rule import Rule
from meow_base.functionality.validation import check_type, valid_dict, \
valid_list
from meow_base.core.vars import EVENT_PATH, EVENT_RULE, \
EVENT_TYPE, EVENT_TYPE_WATCHDOG, JOB_CREATE_TIME, JOB_EVENT, JOB_ID, \
from meow_base.core.vars import EVENT_PATH, EVENT_RULE, EVENT_TIME, \
EVENT_TYPE, JOB_CREATE_TIME, JOB_EVENT, JOB_ID, \
JOB_PATTERN, JOB_RECIPE, JOB_REQUIREMENTS, JOB_RULE, JOB_STATUS, \
JOB_TYPE, STATUS_CREATING, WATCHDOG_BASE, WATCHDOG_HASH, SWEEP_JUMP, \
SWEEP_START, SWEEP_STOP
JOB_TYPE, STATUS_CREATING, SWEEP_JUMP, SWEEP_START, SWEEP_STOP
from meow_base.functionality.naming import generate_job_id
# mig trigger keyword replacements
@ -104,32 +103,17 @@ def create_parameter_sweep(variable_name:str, start:Union[int,float,complex],
}
}
def create_event(event_type:str, path:str, rule:Any, extras:Dict[Any,Any]={}
)->Dict[Any,Any]:
def create_event(event_type:str, path:str, rule:Any, time:float,
extras:Dict[Any,Any]={})->Dict[Any,Any]:
"""Function to create a MEOW dictionary."""
return {
**extras,
EVENT_PATH: path,
EVENT_TYPE: event_type,
EVENT_RULE: rule
EVENT_RULE: rule,
EVENT_TIME: time
}
def create_watchdog_event(path:str, rule:Any, base:str, hash:str,
extras:Dict[Any,Any]={})->Dict[Any,Any]:
"""Function to create a MEOW event dictionary."""
return create_event(
EVENT_TYPE_WATCHDOG,
path,
rule,
extras={
**extras,
**{
WATCHDOG_HASH: hash,
WATCHDOG_BASE: base
}
}
)
def create_job_metadata_dict(job_type:str, event:Dict[str,Any],
extras:Dict[Any,Any]={})->Dict[Any,Any]:
"""Function to create a MEOW job dictionary."""