<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.2.2 (latest released)</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">If I pause/unpause dag in <code class="notranslate">Tree</code>, <code class="notranslate">Graph</code>, or <code class="notranslate">Gantt</code> page, <code class="notranslate">/paused</code> url is calling twice.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/8676247/146517082-b359a81c-a53f-4aa7-a2e8-11bdbdd1e4d8.png"><img src="https://user-images.githubusercontent.com/8676247/146517082-b359a81c-a53f-4aa7-a2e8-11bdbdd1e4d8.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">So paused events are logging twice.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/8676247/146517366-d25efa3c-a029-4aa4-a655-60a8d84a1e1c.png"><img src="https://user-images.githubusercontent.com/8676247/146517366-d25efa3c-a029-4aa4-a655-60a8d84a1e1c.png" alt="image" style="max-width: 100%;"></a></p>
<h3 dir="auto">What you expected to happen</h3>
<p dir="auto">It should be logging only once.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Go to <code class="notranslate">Tree</code>, <code class="notranslate">Graph</code>, or <code class="notranslate">Gantt</code> page. And pause/unpause it.</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">centos</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Other 3rd-party Helm chart</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Anything else</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>
<p dir="auto"><strong>Apache Airflow version</strong>: 1.10.10 (master has same issue)</p>
<p dir="auto"><strong>Kubernetes version (if you are using kubernetes)</strong> (use <code class="notranslate">kubectl version</code>): N/A</p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>:</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): MacOS 10.15.4</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): Darwin Kernel Version 19.4.0</li>
<li><strong>Install tools</strong>: pip</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>

<p dir="auto"><strong>What you expected to happen</strong>:<br>
There is a mismatch between <a href="https://github.com/apache/airflow/blob/9764c90b925a710506f43423302f3fa512490c03/airflow/providers/amazon/aws/hooks/glue.py#L133">return value</a> of <code class="notranslate">job_completion</code> of AwsGlueJobHook and <a href="https://github.com/apache/airflow/blob/9764c90b925a710506f43423302f3fa512490c03/airflow/providers/amazon/aws/sensors/glue.py#L58">end condition</a> in <code class="notranslate">poke</code> of AwsGlueJobSensor. While <code class="notranslate">job_completion</code> returns a dictionary of JobRunState and JobRunId, <code class="notranslate">poke</code> checks if it is 'SUCCEEDED' or 'FAILED' which should be only JobRunState. So the condition always fails and <code class="notranslate">poke</code> always returns False which leads GlueSensor to run indefinitely even if Glue job finished.<br>
Also, I think while loop in <code class="notranslate">job_completion</code> is useless. It should return immediately after it gets response from glue client but doesn't have to wait until it finishes or fails. It is duplicated with execution loop of Sensor.</p>
<p dir="auto"><strong>How to reproduce it</strong>:<br>
Run any job and wait for the job using GlueJobSensor.</p>
<p dir="auto"><strong>Anything else we need to know</strong>:</p>