in src/lookoutequipment/scheduler.py [0:0]
def build_inspection_report(self):
"""
Build the inspection report in Markdown format suitable for displaying
from a Jupyter notebook or any output that can take this format input
Returns:
string:
The inspection report in Markdown format
"""
self.get_next_time_range()
scheduler_description = []
scheduler_description.append(f'**SCHEDULER: {self.scheduler_name}**\n')
scheduler_description.append(f'*Scheduler inspection report run at: {self.current_time}*\n')
scheduler_description.append('Here is the behavior you can expect from this scheduler:\n')
if self.delay_offset > 0:
scheduler_description.append(f'* It will wake up every **{self.frequency} minutes**')
scheduler_description.append(f'and wait for up to **{self.delay_offset} minute(s)** for the data to be available.\n')
else:
scheduler_description.append(f'* It will wake up every **{self.frequency} minutes**.\n')
scheduler_description.append(f'* It will look for CSV files in the following location `{self.s3_input_location}*.csv`.\n')
scheduler_description.append(f'* The current time is **{self.current_time}** and the next time the scheduler will wake up will be **{self.next_wakeup_time}**\n')
scheduler_description.append(f'* The dataset associated to this scheduler\'s model has **{self.num_components} components** in its schema.\n')
scheduler_description.append(f'Each time the scheduler wakes up, it expects to find **{self.num_components} CSV files** in the input location, one for each component as defined in the dataset schema.\n')
scheduler_description.append(f'If the scheduler was to wake up at **{self.next_wakeup_time}**, it would look for the following files:')
for component in self.schema['Components']:
component_name = component['ComponentName']
scheduler_description.append(f'\n* `{component_name}{self.delimiter}{self.next_timestamp}.csv` and this file content would have to follow this template:')
current_table = '\n'
for col in component['Columns']:
current_table += ' | ' + col['Name']
current_table += '|'
current_table += '\n' + '| --- '*len(component['Columns']) + '|'
current_table += f'\n| {str(self.start_time)[:19]}' + '| 0.0 '*(len(component['Columns'])-1) + '|'
current_table += '\n' + '| ... '*len(component['Columns']) + '|'
current_table += f'\n| {str(self.end_time)[:19]}' + '| 0.0 '*(len(component['Columns'])-1) + '|'
scheduler_description.append(current_table)
self.inspection_report = '\n'.join(scheduler_description)
return self.inspection_report