You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jim Baldwin (JIRA)" <ji...@apache.org> on 2019/05/19 00:26:00 UTC

[jira] [Commented] (AIRFLOW-4531) UI Mark success and Mark failed bug

    [ https://issues.apache.org/jira/browse/AIRFLOW-4531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16843277#comment-16843277 ] 

Jim Baldwin commented on AIRFLOW-4531:
--------------------------------------

In this code you can see the post variables being set:
{code:html}
          <form method="POST">
            <input name="csrf_token" type="hidden" value="\{{ csrf_token() }}"/>
            <input name="dag_id" type="hidden">
            <input name="task_id" type="hidden">
            <input name="execution_date" type="hidden">
            <input name="origin" type="hidden" value="\{{ request.base_url }}">
            <button id="btn_run" type="button" class="btn btn-primary"
              title="Runs a single task instance"
              data-action="\{{ url_for('airflow.run') }}">
              Run
            </button>
            <span class="btn-group" data-toggle="buttons">
              <label
                class="btn"
                title="Ignores all non-critical dependencies, including task state and task_deps">
                <input type="checkbox" value="true" name="ignore_all_deps" autocomplete="off">
                Ignore All Deps</label>
              <label class="btn"
                title="Ignore previous success/failure">
                <input type="checkbox" value="true" name="ignore_ti_state" autocomplete="off">
                Ignore Task State
              </label>
              <label class="btn"
                title="Disregard the task-specific dependencies, e.g. status of upstream task instances and depends_on_past">
                <input type="checkbox" value="true" name="ignore_task_deps" autocomplete="off">
                Ignore Task Deps
              </label>
            </span>
            <hr/>
            <button id="btn_clear" type="button" class="btn btn-primary"
                title="Clearing deletes the previous state of the task instance, allowing it to get re-triggered by the scheduler or a backfill command"
                data-action="\{{ url_for('airflow.clear') }}"
                >Clear
            </button>
            <span class="btn-group" data-toggle="buttons">
              <label class="btn"
                title="Also include past task instances when clearing this one">
                <input type="checkbox" value="true" name="past" autocomplete="off">
                Past
              </label>
              <label class="btn"
                title="Also include future task instances when clearing this one">
                <input type="checkbox" value="true" name="future" autocomplete="off">
                Future
              </label>
              <label class="btn"
                title="Also include upstream dependencies">
                <input type="checkbox" value="true" name="upstream" autocomplete="off">
                Upstream
              </label>
              <label class="btn active"
                title="Also include downstream dependencies">
                <input type="checkbox" value="true" name="downstream" checked autocomplete="off">
                Downstream
              </label>
              <label class="btn active">
                <input type="checkbox" value="true" name="recursive" checked autocomplete="off">
                 Recursive
              </label>
            </span>
            <hr/>
            <button id="btn_failed" type="button" class="btn btn-primary"
                data-action="\{{ url_for('airflow.failed') }}">
              Mark Failed
            </button>
            <span class="btn-group" data-toggle="buttons">
              <label class="btn">
                <input type="checkbox" value="true" name="failed_past" autocomplete="off">
                Past
              </label>
              <label class="btn">
                <input type="checkbox" value="true" name="failed_future" autocomplete="off">
                Future
              </label>
              <label class="btn">
                <input type="checkbox" value="true" name="failed_upstream" autocomplete="off">
                Upstream
              </label>
              <label class="btn">
                <input type="checkbox" value="true" name="failed_downstream" autocomplete="off">
                Downstream
              </label>
            </span>
            <hr/>
            <button id="btn_success" type="button" class="btn btn-primary"
                data-action="\{{ url_for('airflow.success') }}">
              Mark Success
            </button>
            <span class="btn-group" data-toggle="buttons">
              <label class="btn">
                <input type="checkbox" value="true" name="success_past" autocomplete="off">
                Past
              </label>
              <label class="btn">
                <input type="checkbox" value="true" name="success_future" autocomplete="off">
                Future
              </label>
              <label class="btn">
                <input type="checkbox" value="true" name="success_upstream" autocomplete="off">
                Upstream
              </label>
              <label class="btn">
                <input type="checkbox" value="true" name="success_downstream" autocomplete="off">
                Downstream
              </label>
            </span>
          </form>{code}

In this code you can see the Flask functions for success and failed still picking up the clear variables. This did work correctly when a get request was being set with the same variable names passed to each function.

Now that it is pulling from the form it needs to refer to the new variable names defined in the HTML.

{code:python}
    @expose('/failed', methods=['POST'])
    @login_required
    @wwwutils.action_logging
    @wwwutils.notify_owner
    def failed(self):
        dag_id = request.form.get('dag_id')
        task_id = request.form.get('task_id')
        origin = request.form.get('origin')
        execution_date = request.form.get('execution_date')

        confirmed = request.form.get('confirmed') == "true"
        upstream = request.form.get('upstream') == "true"
        downstream = request.form.get('downstream') == "true"
        future = request.form.get('future') == "true"
        past = request.form.get('past') == "true"

        return self._mark_task_instance_state(dag_id, task_id, origin, execution_date,
                                              confirmed, upstream, downstream,
                                              future, past, State.FAILED)

    @expose('/success', methods=['POST'])
    @login_required
    @wwwutils.action_logging
    @wwwutils.notify_owner
    def success(self):
        dag_id = request.form.get('dag_id')
        task_id = request.form.get('task_id')
        origin = request.form.get('origin')
        execution_date = request.form.get('execution_date')

        confirmed = request.form.get('confirmed') == "true"
        upstream = request.form.get('upstream') == "true"
        downstream = request.form.get('downstream') == "true"
        future = request.form.get('future') == "true"
        past = request.form.get('past') == "true"

        return self._mark_task_instance_state(dag_id, task_id, origin, execution_date,
                                              confirmed, upstream, downstream,
                                              future, past, State.SUCCESS)
{code}

> UI Mark success and Mark failed bug
> -----------------------------------
>
>                 Key: AIRFLOW-4531
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4531
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: ui
>    Affects Versions: 1.10.3
>            Reporter: Jim Baldwin
>            Assignee: Jim Baldwin
>            Priority: Minor
>
> In 1.10.3 in the graph and tree pages, in the task on click menu, the mark success or mark failure in the GUI will now pick up the options set in Clear i.e. Past, Future, Downstream or Upstream.
> Other users reporting the same issue in slack.
> The work around is to set the options in the Clear settings
> I believe the issue was introduced in https://issues.apache.org/jira/browse/AIRFLOW-4240. In the airflow/www/templates/dag.html file the method was changed to POST and unique variables were set rather than all the buttons passing the same variables in the get to different functions in [airflow/www/views.py|https://github.com/apache/airflow/commit/dbed51e702bf8177800183d2c4f595073aa2339d#diff-948e87b4f8f644b3ad8c7950958df033].
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)