You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Stijn Beauprez (JIRA)" <ji...@apache.org> on 2017/07/26 08:58:01 UTC

[jira] [Commented] (AIRFLOW-1162) execution_date doesn't have a default value exception

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

Stijn Beauprez commented on AIRFLOW-1162:
-----------------------------------------

[~nshay016] Could you explain why this was not an issue? I'm facing the same and can't find what's going on.

> execution_date doesn't have a default value exception
> -----------------------------------------------------
>
>                 Key: AIRFLOW-1162
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1162
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: DagRun
>    Affects Versions: Airflow 1.8, 1.8.0
>         Environment: mysql db, standard linux environment
>            Reporter: Neer Shay
>
> Example DAG:
> default_args = {
>     'owner': 'airflow',
>     'depends_on_past': False,
>     'start_date': datetime(2017, 4, 27),
>     'email': ['airflow@airflow.com'],
>     'email_on_failure': False,
>     'email_on_retry': False,
> }
> dag = DAG('tutorial_new_dag', default_args=default_args)
> t1 = BashOperator(
>     task_id='print_date',
>     bash_command='date',
>     dag=dag)
> Running this DAG through the web-ui using the "run now" button produces the following exception:
> Traceback (most recent call last):
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
> response = self.full_dispatch_request()
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
> rv = self.handle_user_exception(e)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
> reraise(exc_type, exc_value, tb)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
> rv = self.dispatch_request()
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask_admin/base.py", line 69, in inner
> return self._run_view(f, *args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask_admin/base.py", line 368, in _run_view
> return fn(self, *args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/flask_login.py", line 755, in decorated_view
> return func(*args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/www/utils.py", line 125, in wrapper
> return f(*args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/www/utils.py", line 172, in wrapper
> return f(*args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/www/views.py", line 986, in trigger
> external_trigger=True
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/utils/db.py", line 53, in wrapper
> result = func(*args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/models.py", line 3383, in create_dagrun
> run.verify_integrity(session=session)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/utils/db.py", line 53, in wrapper
> result = func(*args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/models.py", line 4117, in verify_integrity
> session.commit()
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 874, in commit
> self.transaction.commit()
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 461, in commit
> self._prepare_impl()
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 441, in _prepare_impl
> self.session.flush()
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2139, in flush
> self._flush(objects)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2259, in _flush
> transaction.rollback(_capture_exception=True)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
> compat.reraise(exc_type, exc_value, exc_tb)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2223, in _flush
> flush_context.execute()
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
> rec.execute(self)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
> uow
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
> mapper, table, insert)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 835, in _emit_insert_statements
> execute(statement, params)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
> return meth(self, multiparams, params)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
> return connection._execute_clauseelement(self, multiparams, params)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
> compiled_sql, distilled_params
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
> context)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
> exc_info
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
> reraise(type(exception), exception, tb=exc_tb, cause=cause)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
> context)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
> cursor.execute(statement, parameters)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
> self.errorhandler(self, exc, value)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
> raise errorclass, errorvalue
> OperationalError: (_mysql_exceptions.OperationalError) (1364, "Field 'execution_date' doesn't have a default value") [SQL: u'INSERT INTO task_instance (task_id, dag_id, start_date, end_date, duration, state, try_number, hostname, unixname, job_id, pool, queue, priority_weight, operator, queued_dttm, pid) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'] [parameters: ('print_date', 'tutorial_new_dag', None, None, None, None, 0, u'', 'username', None, None, 'default', 1, None, None, None)]
> Running with the scheduler isn't much better (below is the exception thrown by the scheduler)
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
> self.run()
>   File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
> self._target(*self._args, **self._kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/jobs.py", line 346, in helper
> pickle_dags)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/utils/db.py", line 53, in wrapper
> result = func(*args, **kwargs)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/jobs.py", line 1581, in process_file
> self._process_dags(dagbag, dags, ti_keys_to_schedule)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/jobs.py", line 1174, in _process_dags
> self._process_task_instances(dag, tis_out)
>   File "~/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/jobs.py", line 862, in _process_task_instances
> if run.execution_date > datetime.now():
> TypeError: can't compare datetime.datetime to NoneType



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)