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

Joy Peterson commented on AIRFLOW-4431:
---------------------------------------

[~diederikwp], This is happening for me when I dynamically add a task after the 
start of the DAG run.

 
  
 
{noformat}
def createDynamicETL(task_id, callableFunction, args):
    task = PythonOperator(
       task_id=task_id,
       provide_context=True,
       # Eval is used since the callableFunction var is of type string
       # while the python_callable argument for PythonOperators only receives 
objects of type callable not strings.
       python_callable=eval(callableFunction),
       op_kwargs=args,
       dag=dag,
    ) return task

...

brands = Variable.get(f"{main_dag_id}_brands", [], 
deserialize_json=True)logging.info(f"Current {main_dag_id}_brands value is 
{str(brands)}")

for brand in brands:
    fetch_offer_listings_task = createDynamicETL(
        f"{clean_task_id(brand)}-fetch_offer_listings",
        "fetch_offer_listings",
        {"brand_name": brand},
    )
    insert_offer_listings_task = createDynamicETL(
        f"{clean_task_id(brand)}-insert_offer_listings",
        "insert_offer_listings",
        {"brand_name": brand},
    )

    starting_line_task >> fetch_offer_listings_task >> bridge_task >> 
insert_offer_listings_task >> del_files_task

start_task >> check_config_task >> check_config_branch_task >> [
    starting_line_task,
    update_config_task,
]

update_config_task >> starting_line_task
del_files_task >> end_task{noformat}
check_config_branch_task is a BranchPythonOperator.  If it triggers the 
update_config_task path then
 # brands is modified
 # the state of the del_files_task, end_task, and bridge_task tasks are set to 
none in case they were not already linked together (such as when there were no 
brands initially)
 # time.sleep(10) is called to allow the "for brand in brands" loop to execute 
again and fill in the <brand>-fetch_offer_listings and 
<brand>-isnert_offer_listings tasks.  
 # Then execution continues to starting_line_task



When Airflow tries to display the gantt chart, it reports this error on the 
first <brand>-fetch_offer_listings task because for some reason it does not 
have a value for start_date.
 
 

 

> 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