sqlalchemy.exc.IntegrityError
I've setup the default dags that come with the installation. Celery/RabbitMQ is working now and when I run a task, I get this error:
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: task_instance.task_id, task_instance.dag_id, task_instance.execution_date [SQL: u'INSERT INTO task_instance (task_id, dag_id, execution_date, start_date, end_date, duration, state, try_number, hostname, unixname, job_id, pool, queue, priority_weight) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('print_the_context', 'example_python_operator', '2015-01-01 00:00:00.000000', '2015-07-28 05:27:40.692490', None, None, 'running', 1, 'SRV01', 'root', '8', None, 'celery', 11)]
I installed postgres and set it up, same error:
sqlalchemy.exc.IntegrityError: (psycopg2.IntegrityError) duplicate key value violates unique constraint "task_instance_pkey"
DETAIL: Key (task_id, dag_id, execution_date)=(print_date, tutorial, 2015-07-28 00:00:00) already exists.
[SQL: 'INSERT INTO task_instance (task_id, dag_id, execution_date, start_date, end_date, duration, state, try_number, hostname, unixname, job_id, pool, queue, priority_weight) VALUES (%(task_id)s, %(dag_id)s, %(execution_date)s, %(start_date)s, %(end_date)s, %(duration)s, %(state)s, %(try_number)s, %(hostname)s, %(unixname)s, %(job_id)s, %(pool)s, %(queue)s, %(priority_weight)s)'] [parameters: {'hostname': 'BNA001082-SRV01', 'end_date': None, 'task_id': 'print_date', 'execution_date': datetime.datetime(2015, 7, 28, 0, 0), 'job_id': '1', 'try_number': 1, 'queue': 'celery', 'state': 'running', 'dag_id': 'tutorial', 'duration': None, 'priority_weight': 3, 'start_date': datetime.datetime(2015, 7, 28, 7, 31, 34, 429420), 'pool': None, 'unixname': 'root'}]
Can you describe what you're doing/how you setup airflow in a little more detail?
Setup airflow according to the tutorial on an Ubuntu server. Setup Celery accordingly, RabbitMQ, installed postgresql, created username, password, etc. ran airflow initdb (no errors). Then I run airflow worker -q celery (that's the queue I defined) and run airflow weberver -p 8080. I see the default example dags, but when I try to run a task I get this error
Which driver are you using for postgres (at the beginning of your sql alchemy URI)?
relevant: https://github.com/airbnb/airflow/issues/161
I use this: postgresql://username:password@localhost/database
Connection seems to be OK, database is filled.
Sorry about the delay, can you provide the full stack trace and airflow version you are using?
Please reopen if it's sitll a problem
Similar issue: I'm currently testing using celery, rabbitmq and mysql for celery backend. Examples run fine, but a simple test with one BashOperator (it calls a php script) and the worker throws this:
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 10, in
The task instance is always stuck at the running stage. This was done on a fresh airflow db.
Any pointer would be awesome!
Actually, even with the sequential executor, I get the same error from the scheduler. I renamed the operator's instance (the task), doesn't change anything, same error. The php script runs fine in standalone.
If I mark the first task instance as successful, it seems every subsequent ones will run fine.
Also, (might be a separate issue) the tree view shows empty boxes while I have 9 successful runs, and the range being displayed definitely fit the runs.