Giter VIP home page Giter VIP logo

rb_status_plugin's People

Contributors

andriisr avatar ceyevar avatar dependabot[bot] avatar rbriski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

trejas

rb_status_plugin's Issues

Lumen DAGs should not reflect the task status, but "pass" if the DAG could complete

I was messing around with different types of quality checks and I noticed that the Lumen report DAGs actually have 2 different types of failures.

  1. Fail if any of the list of tests fail
  2. Fail if it's set up incorrectly, for example, the send email task fails or a test no longer exists.

So, the second option is basically a status of the status tests ... kinda meta, but important. We should think of a different way for the Lumen report DAGs to report success or failure.

Tests metadata in UI

  • adding metadata for tasks (schedule, description, last run)
  • differentiating between tasks that are part of active/disabled dag when creating report
  • do we alert owner/user if underlying dag changes schedule?
  • how does a task's last run date (vs. report's last run date) affect status

Report UI uses dag_run.id instead of dag_run.dag_id

We probably want the value displayed to be the name of the dag and not the number of the run. The number doesn't have much semantic value alone. Example:

  1. Report is called example_dag
  2. The id passed to the UI is an integer like '9' instead of example_Dag

Editing an existing report

We need to populate the existing report configurations into the UI when a user edit's an existing report.

Email callback in lumen dag

  1. Implement email callback function using email operator with templated html from Andrei
  2. Ensure one email is sent at the end of dag reporting all failures and success
  3. Test in Astro

Populating Tests when editing/creating a report

We need to upload the list of all available tests for the user, when they are building a report.

Currently the UI is populating sample tests, but we need to extract the list of tests as dag_name.task_name from airflow's postgres db.

Create Report UI: string format error when schedule is daily and all other schedule fields empty


Node: weightless-sun-9695-webserver-b67c544b6-cr5h2

Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/lib/python3.7/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
return f(self, *args, **kwargs)
File "/usr/local/airflow/plugins/lumen_plugin/views.py", line 176, in form_post
extract_report_data_into_airflow(form)
File "/usr/local/airflow/plugins/lumen_plugin/helpers/report_save_helpers.py", line 29, in extract_report_data_into_airflow
convert_schedule_to_cron_expression(report_dict, form)
File "/usr/local/airflow/plugins/lumen_plugin/helpers/report_save_helpers.py", line 79, in convert_schedule_to_cron_expression
time_of_day = form.schedule_time.data.strftime("%H:%M")
AttributeError: 'NoneType' object has no attribute 'strftime'

Triggering Report

The UI is already in place, but we need to create a hook that will call the underlying dag to run in real-time when a user clicks the trigger report button.

Pause & Unpause a report

The UI is already in place, but we need to create a hook that will change the state of the report's underlying dag to ON or OFF.

Delete Report

The UI is already in place, but we need to create a hook that will first delete the airflow variable for the report and then the underlying dag for the report, when the user clicks delete report button.

Read and parse test configs

Configs looks like this:

{
  "tests": [
    "dag_name.operator_1", 
    "dag_name.operator_3"
  ],
  "emails": ["[email protected]", "[email protected]"],
  "schedule": "0 7 * * *"
}

Lumen needs to be able to read all variables and parse the report configs.

Lumen test config variables are prefixed with lumen_test_

Editing Report (Displaying Schedule)

When editing an existing report, the schedule should show up in the same format as it was during last save.

Ie. We don't want to display a cron expression when a user goes back to edit a report, if the user originally saved it using the non-cron options.

Airflow variable key/name

We need to embed into the report management workflow a pattern such that:

  • the initial report title is tied to the variable name
  • if a user changes the report title, only the report title attribute is changed in the variable and not the actual variable's name
  • the Lumen UI can still find the report and populate the proper report title in each of the pages

Should deleting a report DAG in the Airflow UI, delete it from Lumen

Right now, if you delete a Lumen report DAG in the Airflow UI, it just comes back later. You can only truly remove it if you remove the Variable that creates it. When we change to a DB backed management system, it will only be removed when you remove it from the Lumen database tables.

Should removing that DAG in the UI remove it in Lumen?

Report Form Errors

How to handle errors when user submits form (ie. bad email).

Currently, it will throw an airflow error on a new page.

To fix this issue, we should show error(s) at top of the same page when user clicks Save Button.

Lumen BaseView can not throw 500s on errors

The reports_data method (and other methods) on Lumen views should handle errors gracefully. Probably logging them and maybe showing an error in the page. It should not throw a 500 and fail like it does now.

Example

When the ReportInstance tries to get_latest if there is no available run, it throws an exception. This exception results in a 500 in the report view.

Create report

Lumen Back End should be able to extract the data from the Report Management UI into an airflow variable when the user clicks the "Save" button on a new report.

Email Unit Tests

We need unit tests for email.

  1. Test each of the three statuses: [Success, Failed, Unknown]

Report class's attributes

Adding all attributes about a report, so that a Report object has all required information about itself.

ReportInstance class uses the lumen dag failure status to determine test failure. It should use only test task failures.

I think this needs to be changed to only take into consideration test tasks. Example:

  1. The email send operator fails but all the test tasks succeed
  2. The report will show as failed even though all the tests tasks passed because the email operator failure set the dag status to failed

I have helper functions in email_helpers.py that determine test tasks and I think should be moved to the reportinstance class

Additional attributes for airflow report variables

We need to have the following attributes in the value of the airflow variable:
report_title
description
owner_name
owner_email
subscribers
tests
schedule

Note that emails has been renamed to subscribers and also that subscribers is a union of owner_email and subscribers.

Create LumenOperator

Queries postgres for status of task_instance (aka a test) and then fails or succeeds based on task_instance's status.

Create Report UI: Submitting form with missing fields

What fields are required in the create form field?

The only field that prevents submission from what I can tell is emails not being formatted. I was able to have "report submitted" appear with this report with no title and no tests and no schedule

image

Lumen BLL: helpers -> classes

Moving helper functions into classes (based on their functionality) in order to give a more holistic view of how each function ties together.

Error for testing invalid emails

======================================================================
 
FAIL: test_invalid_email (lumen_report_save_test.ReportSaveTest)
 
Test that errors are thrown with an invalid email.
 
----------------------------------------------------------------------
 
Traceback (most recent call last):
 
  File "/home/circleci/lumen-test-airflow/plugins/lumen_plugin/tests/lumen_report_save_test.py", line 206, in test_invalid_email
 
    in str(context.exception)
 
AssertionError: False is not true
 

 
----------------------------------------------------------------------
 

Populating /reports Page

Currently, /lumen/reports/ is being populated by dummy_reports.

The page should be populated with real report data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.