<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.5.3</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">When trying to view the logs for a task on a manual DAG run I get a nasty error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File &quot;/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File &quot;/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File &quot;/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File &quot;/venv/lib/python3.9/site-packages/airflow/www/auth.py&quot;, line 47, in decorated
    return func(*args, **kwargs)
  File &quot;/venv/lib/python3.9/site-packages/airflow/www/decorators.py&quot;, line 166, in view_func
    return f(*args, **kwargs)
  File &quot;/venv/lib/python3.9/site-packages/airflow/www/decorators.py&quot;, line 125, in wrapper
    return f(*args, **kwargs)
  File &quot;/venv/lib/python3.9/site-packages/airflow/utils/session.py&quot;, line 75, in wrapper
    return func(*args, session=session, **kwargs)
  File &quot;/venv/lib/python3.9/site-packages/airflow/www/views.py&quot;, line 2823, in graph
    dt_nr_dr_data = get_date_time_num_runs_dag_runs_form_data(request, session, dag)
  File &quot;/venv/lib/python3.9/site-packages/airflow/www/views.py&quot;, line 193, in get_date_time_num_runs_dag_runs_form_data
    date_time = dagrun.execution_date
AttributeError: 'NoneType' object has no attribute 'execution_date'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "/venv/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "/venv/lib/python3.9/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/venv/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/venv/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/venv/lib/python3.9/site-packages/airflow/www/auth.py", line 47, in decorated
    return func(*args, **kwargs)
  File "/venv/lib/python3.9/site-packages/airflow/www/decorators.py", line 166, in view_func
    return f(*args, **kwargs)
  File "/venv/lib/python3.9/site-packages/airflow/www/decorators.py", line 125, in wrapper
    return f(*args, **kwargs)
  File "/venv/lib/python3.9/site-packages/airflow/utils/session.py", line 75, in wrapper
    return func(*args, session=session, **kwargs)
  File "/venv/lib/python3.9/site-packages/airflow/www/views.py", line 2823, in graph
    dt_nr_dr_data = get_date_time_num_runs_dag_runs_form_data(request, session, dag)
  File "/venv/lib/python3.9/site-packages/airflow/www/views.py", line 193, in get_date_time_num_runs_dag_runs_form_data
    date_time = dagrun.execution_date
AttributeError: 'NoneType' object has no attribute 'execution_date'
</code></pre></div>
<p dir="auto">Looking through the code I can see it is failing to find the dag_run. The cause of this is because the run_id is set to the string:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="manual__2023-04-26T18:18:28.720589 00:00"><pre class="notranslate"><code class="notranslate">manual__2023-04-26T18:18:28.720589 00:00
</code></pre></div>
<p dir="auto">but in the db its actually:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="manual__2023-04-26T18:18:28.720589+00:00"><pre class="notranslate"><code class="notranslate">manual__2023-04-26T18:18:28.720589+00:00
</code></pre></div>
<p dir="auto">(notice the absence of the plus for the timezone separator).</p>
<p dir="auto">As a hack and to prove this was the issue I modified line 1390 in airflow/models/dag.py from:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="query = query.filter(DagRun.dag_id == self.dag_id, DagRun.run_id == run_id)"><pre class="notranslate"><code class="notranslate">query = query.filter(DagRun.dag_id == self.dag_id, DagRun.run_id == run_id)
</code></pre></div>
<p dir="auto">to:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="query = query.filter(DagRun.dag_id == self.dag_id, DagRun.run_id == run_id.replace(' 00:00', '+00:00'))"><pre class="notranslate"><code class="notranslate">query = query.filter(DagRun.dag_id == self.dag_id, DagRun.run_id == run_id.replace(' 00:00', '+00:00'))
</code></pre></div>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">The log files for my task should have been presented to me in their full glory.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Initiate a manual run of a task. Let it finish.<br>
Click the "success" icon from the home screen for the dag<br>
Click the "run_id" value for the latest run.</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"</p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Virtualenv installation</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto">This was upgraded from an unused install of airflow v2.1.2 although there were no previously run DAGs and this happens on new run so I dont think its an issue related to the migration of data.</p>
<p dir="auto">Python 3.9.9</p>
<h3 dir="auto">Anything else</h3>
<p dir="auto">Happens every time.</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"> 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>
<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.5.3</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">When TI has cleared RunID + replace to spacebar<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/61796911/234028990-58a56692-d3dc-4ef2-8c4d-ff5235357581.png"><img width="779" alt="Снимок экрана 2023-04-24 в 17 34 35" src="https://user-images.githubusercontent.com/61796911/234028990-58a56692-d3dc-4ef2-8c4d-ff5235357581.png" style="max-width: 100%;"></a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/61796911/234029184-a284524c-8409-4d27-820c-63407794e023.png"><img width="688" alt="Снимок экрана 2023-04-24 в 17 35 18" src="https://user-images.githubusercontent.com/61796911/234029184-a284524c-8409-4d27-820c-63407794e023.png" style="max-width: 100%;"></a></p>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">How to reproduce</h3>
<ol dir="auto">
<li>Filter by RunID</li>
<li>Clear Task Instance</li>
<li>Look at RunID value</li>
</ol>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Ubuntu 22.04.1 LTS</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">Official Apache Airflow 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"> 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>