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

Diederik Perdok commented on AIRFLOW-4431:
------------------------------------------

Thanks [~JoyPeterson]. I've tried creating DAGs which dynamically add and 
remove tasks but this did not reproduce the issue. I've tried it on 10.4 just 
in case the issue would already be solved in a later version.

The following DAG is an example of the things I've tried (letting it backfill 
to run it many times)
{code:python}
default_args = {
    "start_date": datetime(2020, 8, 1),
}

dag = DAG('test_dynamically_add_remove_task_on_odd_microsecond', 
default_args=default_args, schedule_interval='@hourly')
hello_world = BashOperator(task_id='hello_world', bash_command='echo "Hello 
World!"', dag=dag)

# Add task with 50% probability every time the DAG is processed
if timezone.utcnow().microsecond % 2 == 1: 
    goodbye_world = BashOperator(task_id='goodbye_world', bash_command='echo 
"Goodbye World!"', dag=dag)
    hello_world >> goodbye_world
{code}
I've tried a number of variations with no luck, like adding or removing tasks 
only after the dag had finished (with or without making them reappear after a 
while), adding new tasks in front of the first or after the final task etc. So 
the problem could be unrelated to dynamically adding tasks, or it could be due 
to a tricky race condition that only occurs under very specific circumstances.

An easy "solution" would be to add a filter to the Gantt chart view to exclude 
any task failures without a start date. This simply hides the problem by 
treating the symptom, but does nothing to fix the underlying cause (of tasks 
being in a state where they somehow failed without ever starting but 
successfully ran to completion as well). Fixing the root cause would still be 
preferred, but then someone who knows how to do that should take over the issue 
from me.

[~ash] (or any other committer or PMC-member), what do you think?

> Gantt chart tab do not showing
> ------------------------------
>
>                 Key: AIRFLOW-4431
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4431
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: webserver
>    Affects Versions: 1.10.3
>         Environment: Ubuntu 16
> Python 3.5.2
>            Reporter: Dmytro Kulyk
>            Assignee: Diederik Perdok
>            Priority: Major
>              Labels: gantt
>
> There is an error when opening Gantt chart in WebUI
> {code}
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2292, in 
> wsgi_app
>     response = self.full_dispatch_request()
>   File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1815, in 
> full_dispatch_request
>     rv = self.handle_user_exception(e)
>   File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1718, in 
> handle_user_exception
>     reraise(exc_type, exc_value, tb)
>   File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 35, in 
> reraise
>     raise value
>   File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1813, in 
> full_dispatch_request
>     rv = self.dispatch_request()
>   File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1799, in 
> dispatch_request
>     return self.view_functions[rule.endpoint](**req.view_args)
>   File "/usr/local/lib/python3.5/dist-packages/flask_admin/base.py", line 69, 
> in inner
>     return self._run_view(f, *args, **kwargs)
>   File "/usr/local/lib/python3.5/dist-packages/flask_admin/base.py", line 
> 368, in _run_view
>     return fn(self, *args, **kwargs)
>   File "/usr/local/lib/python3.5/dist-packages/flask_login/utils.py", line 
> 261, in decorated_view
>     return func(*args, **kwargs)
>   File "/usr/local/lib/python3.5/dist-packages/airflow/www/utils.py", line 
> 275, in wrapper
>     return f(*args, **kwargs)
>   File "/usr/local/lib/python3.5/dist-packages/airflow/utils/db.py", line 73, 
> in wrapper
>     return func(*args, **kwargs)
>   File "/usr/local/lib/python3.5/dist-packages/airflow/www/views.py", line 
> 1988, in gantt
>     'startDate': wwwutils.epoch(start_date),
>   File "/usr/local/lib/python3.5/dist-packages/airflow/www/utils.py", line 
> 245, in epoch
>     return int(time.mktime(dttm.timetuple())) * 1000,
> AttributeError: 'NoneType' object has no attribute 'timetuple'
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to