Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DAG Docs to Trigger UI #13365

Merged
merged 4 commits into from
Jan 7, 2021

Conversation

jyotidhiman0610
Copy link
Contributor

closes #12550

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Dec 29, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Dec 29, 2020

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@ryanahamilton ryanahamilton self-requested a review January 4, 2021 15:15
Copy link
Contributor

@ryanahamilton ryanahamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Thanks @jyotidhiman0610!

@github-actions
Copy link

github-actions bot commented Jan 4, 2021

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jan 4, 2021
@jyotidhiman0610
Copy link
Contributor Author

@ryanahamilton how can I merge this PR?
Also, the 4 failing checks seem unrelated to the PR. Can you please help?

Copy link
Contributor

@ryanahamilton ryanahamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appears to be a related error in there:

=================================== FAILURES ===================================
  ________________ TestTriggerDag.test_trigger_dag_params_conf_1 _________________
  
  a = (<tests.www.test_views.TestTriggerDag testMethod=test_trigger_dag_params_conf_1>,)
  
      @wraps(func)
      def standalone_func(*a):
  >       return func(*(a + p.args), **p.kwargs)
  
  /usr/local/lib/python3.6/site-packages/parameterized/parameterized.py:530: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  tests/www/test_views.py:2791: in test_trigger_dag_params_conf
      resp = self.client.get(f'trigger?dag_id={test_dag_id}&conf={test_request_conf}')
  /usr/local/lib/python3.6/site-packages/werkzeug/test.py:1006: in get
      return self.open(*args, **kw)
  /usr/local/lib/python3.6/site-packages/flask/testing.py:227: in open
      follow_redirects=follow_redirects,
  /usr/local/lib/python3.6/site-packages/werkzeug/test.py:970: in open
      response = self.run_wsgi_app(environ.copy(), buffered=buffered)
  /usr/local/lib/python3.6/site-packages/werkzeug/test.py:861: in run_wsgi_app
      rv = run_wsgi_app(self.application, environ, buffered=buffered)
  /usr/local/lib/python3.6/site-packages/werkzeug/test.py:1096: in run_wsgi_app
      app_rv = app(environ, start_response)
  /usr/local/lib/python3.6/site-packages/flask/app.py:2464: in __call__
      return self.wsgi_app(environ, start_response)
  /usr/local/lib/python3.6/site-packages/flask/app.py:2450: in wsgi_app
      response = self.handle_exception(e)
  /usr/local/lib/python3.6/site-packages/flask/app.py:1867: in handle_exception
      reraise(exc_type, exc_value, tb)
  /usr/local/lib/python3.6/site-packages/flask/_compat.py:39: in reraise
      raise value
  /usr/local/lib/python3.6/site-packages/flask/app.py:2447: in wsgi_app
      response = self.full_dispatch_request()
  /usr/local/lib/python3.6/site-packages/flask/app.py:1952: in full_dispatch_request
      rv = self.handle_user_exception(e)
  /usr/local/lib/python3.6/site-packages/flask/app.py:1821: in handle_user_exception
      reraise(exc_type, exc_value, tb)
  /usr/local/lib/python3.6/site-packages/flask/_compat.py:39: in reraise
      raise value
  /usr/local/lib/python3.6/site-packages/flask/app.py:1950: in full_dispatch_request
      rv = self.dispatch_request()
  /usr/local/lib/python3.6/site-packages/flask/app.py:1936: in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
  airflow/www/auth.py:34: in decorated
      return func(*args, **kwargs)
  airflow/www/decorators.py:60: in wrapper
      return f(*args, **kwargs)
  airflow/utils/session.py:65: in wrapper
      return func(*args, session=session, **kwargs)
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  
  self = <airflow.www.views.Airflow object at 0x7fb436cab6d8>
  session = <sqlalchemy.orm.session.Session object at 0x7fb43604c2b0>
  
      @expose('/trigger', methods=['POST', 'GET'])
      @auth.has_access(
          [
              (permissions.ACTION_CAN_READ, permissions.RESOURCE_DAG),
              (permissions.ACTION_CAN_CREATE, permissions.RESOURCE_DAG_RUN),
          ]
      )
      @action_logging
      @provide_session
      def trigger(self, session=None):
          """Triggers DAG Run."""
          dag_id = request.values.get('dag_id')
          origin = get_safe_url(request.values.get('origin'))
          request_conf = request.values.get('conf')
      
          if request.method == 'GET':
              # Populate conf textarea with conf requests parameter, or dag.params
              default_conf = ''
              if request_conf:
                  default_conf = request_conf
              else:
                  try:
                      dag = current_app.dag_bag.get_dag(dag_id)
      
                      doc_md = wwwutils.wrapped_markdown(getattr(dag, 'doc_md', None))
                      default_conf = json.dumps(dag.params, indent=4)
                  except TypeError:
                      flash("Could not pre-populate conf field due to non-JSON-serializable data-types")
              return self.render_template(
  >               'airflow/trigger.html', dag_id=dag_id, origin=origin, conf=default_conf, doc_md=doc_md
              )
  E           UnboundLocalError: local variable 'doc_md' referenced before assignment
  
  airflow/www/views.py:1423: UnboundLocalError

@github-actions github-actions bot removed the okay to merge It's ok to merge this PR as it does not require more tests label Jan 5, 2021
@jyotidhiman0610
Copy link
Contributor Author

@ryanahamilton Thank you so much for pointing out the test case, I have done the necessary changes & all the tests have passed.
Request you to kindly take a look.

@kaxil kaxil merged commit 0e510b2 into apache:master Jan 7, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 7, 2021

Awesome work, congrats on your first merged pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to provide sample conf JSON for a dag in trigger page
3 participants