jobflow_remote.utils.data module#
- jobflow_remote.utils.data.convert_store(spec_dict: dict, valid_stores) Store [source]#
Build a store based on the dict spec configuration from JobFlow TODO expose the methods from jobflow and don’t duplicate the code.
- jobflow_remote.utils.data.convert_utc_time(datetime_value: datetime) datetime [source]#
Convert a time in UTC (used in the DB) to the time zone of the system where the code is being executed.
- Parameters:
datetime_value – a datetime object in UTC
- Return type:
The datetime in the zone of the current system
- jobflow_remote.utils.data.deep_merge_dict(d1: MutableMapping, d2: Mapping, path: list[str] | None = None, raise_on_conflicts: bool = True, inplace: bool = True) MutableMapping [source]#
Merge a dictionary d2 into a dictionary d1 recursively.
- Parameters:
d1
d2
path
raise_on_conflicts
inplace
- jobflow_remote.utils.data.get_past_time_rounded(interval: str, num_intervals: int, reference: datetime | None = None) datetime [source]#
Return a datetime object that is the specified number of intervals in the past relative to the given reference datetime. The returned datetime is rounded to the nearest interval start time.
- Parameters:
interval – One of ‘hours’, ‘days’, ‘weeks’, ‘months’, ‘years’
num_intervals – The number of intervals to go back in time
reference – The datetime to use as the reference for the calculation. If not specified, the current time is used.
- Returns:
The datetime object that is the specified number of intervals in the past relative to the given reference datetime.
- Return type:
datetime
- jobflow_remote.utils.data.get_utc_offset(timezone: str)[source]#
Return the UTC offset of the given timezone as a string.
- Parameters:
timezone – The timezone for which to get the UTC offset.
- Returns:
The UTC offset as a string in the format +/-HH:MM.
- Return type: