Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Airflow Worker not Working When I run Backfill commands #63

Closed
r39132 opened this issue Jun 22, 2015 · 2 comments
Closed

Airflow Worker not Working When I run Backfill commands #63

r39132 opened this issue Jun 22, 2015 · 2 comments

Comments

@r39132
Copy link
Contributor

r39132 commented Jun 22, 2015

I am using the CeleryExecutor with a Postgres results backend and queue. It looks like this fails when I run "airflow backfill" commands but works when I use the UI.

Sid-As-MBP-15:airflow siddharth$ airflow worker

 -------------- celery@Sid-As-MacBook-Pro-15.local v3.1.18 (Cipater)
---- **** ----- 
--- * ***  * -- Darwin-14.3.0-x86_64-i386-64bit
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         airflow.executors.celery_executor:0x10c04e690
- ** ---------- .> transport:   sqla+postgresql://siddharth@localhost:5432/airflow_celery
- ** ---------- .> results:     db+postgresql://siddharth@localhost:5432/airflow_celery
- *** --- * --- .> concurrency: 16 (prefork)
-- ******* ---- 
--- ***** ----- [queues]
 -------------- .> default          exchange=celery(direct) key=celery


[2015-06-22 15:08:15,337: WARNING/MainProcess] celery@Sid-As-MacBook-Pro-15.local ready.
Starting flask
 * Running on http://0.0.0.0:8793/ (Press CTRL+C to quit)
Traceback (most recent call last):
  File "/usr/local/bin/airflow", line 10, in <module>
    args.func(args)
  File "/usr/local/lib/python2.7/site-packages/airflow/bin/cli.py", line 97, in run
    DagPickle).filter(DagPickle.id == args.pickle).first()
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2444, in first
    ret = list(self[0:1])
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2280, in __getitem__
    return list(res)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 84, in instances
    util.raise_from_cause(err)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 69, in instances
    rows = [proc(row) for row in fetch]
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 426, in _instance
    loaded_instance, populate_existing, populators)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 484, in _populate_full
    dict_[key] = getter(row)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/sql/sqltypes.py", line 1261, in process
    return loads(value)
  File "/usr/local/lib/python2.7/site-packages/dill/dill.py", line 209, in loads
    return load(file)
  File "/usr/local/lib/python2.7/site-packages/dill/dill.py", line 199, in load
    obj = pik.load()
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1090, in load_global
    klass = self.find_class(module, name)
  File "/usr/local/lib/python2.7/site-packages/dill/dill.py", line 278, in find_class
    return StockUnpickler.find_class(self, module, name)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1124, in find_class
    __import__(module)
ImportError: No module named python_operator
[2015-06-22 15:11:08,787: ERROR/Worker-14] 1
[2015-06-22 15:11:08,835: ERROR/MainProcess] Task airflow.executors.celery_executor.execute_command[4a012cf5-83f6-4d54-af34-b2ce74b517db] raised unexpected: Exception('Celery command failed',)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/airflow/executors/celery_executor.py", line 41, in execute_command
    raise Exception('Celery command failed')
Exception: Celery command failed

My airflow.cfg file has the following settings for celery


# The Celery broker URL. Celery supports RabbitMQ, Redis and experimentaly
# a sqlalchemy database. Refer to the Celery documentation for more
# information.
#broker_url = sqla+mysql://airflow:airflow@localhost:3306/airflow
broker_url = sqla+postgresql://siddharth@localhost:5432/airflow_celery

# Another key Celery setting
#celery_result_backend = db+mysql://airflow:airflow@localhost:3306/airflow
celery_result_backend = db+postgresql://siddharth@localhost:5432/airflow_celery

I am getting this error with the example_python_operator and example_bash_operator flows. I haven't tried others.

airflow flower is not much help for experimental brokers like Postgres (over SQLAlchemy) since many commands are unsupported as mentioned in the Limitations section of this

Sid-As-MacBook-Pro-15:airflow siddharth$ airflow flower
[I 150622 15:05:54 command:114] Visit me at http://localhost:5555
[I 150622 15:05:55 command:116] Broker: sqla+postgresql://siddharth@localhost:5432/airflow_celery
[I 150622 15:05:55 command:119] Registered tasks:
    ['celery.backend_cleanup',
     'celery.chain',
     'celery.chord',
     'celery.chord_unlock',
     'celery.chunks',
     'celery.group',
     'celery.map',
     'celery.starmap']
[I 150622 15:05:55 mixins:225] Connected to sqla+postgresql://siddharth@localhost:5432/airflow_celery
[W 150622 15:05:58 control:43] 'stats' inspect method failed
[W 150622 15:05:58 control:43] 'active_queues' inspect method failed
[W 150622 15:05:58 control:43] 'registered' inspect method failed
[W 150622 15:05:58 control:43] 'scheduled' inspect method failed
[W 150622 15:05:58 control:43] 'active' inspect method failed
[W 150622 15:05:58 control:43] 'reserved' inspect method failed
[W 150622 15:05:58 control:43] 'revoked' inspect method failed
[W 150622 15:05:58 control:43] 'conf' inspect method failed

If I look into my database (airflow_celery), I find 2 tables : kombu_message and kombu_queue.

In kombu_queue, I'm expecting a single queue called default, but I see several

airflow_celery=# select * from kombu_queue ;
 id |                           name                           
----+----------------------------------------------------------
  1 | default
  2 | celery@Sid-As-MacBook-Pro-15.local.celery.pidbox
  3 | celeryev.ad9d88a9-05b7-4d01-ad2c-8f95662787a0
  4 | 37bb18ec-a47f-349b-859f-3b454d2602a3.reply.celery.pidbox
  5 | b15e35ef-8873-31d6-8841-af833b9cec3d.reply.celery.pidbox
  6 | 4572302e-65a9-3ec1-850e-aff27cd59a9b.reply.celery.pidbox
  7 | 33d4dcc5-f997-3b7c-9f41-66d9a2c51159.reply.celery.pidbox
@r39132 r39132 changed the title Airflow Worker not Working Airflow Worker not Working When I run Backfill commands Jun 22, 2015
@mistercrunch
Copy link
Member

The command runs as a subprocess so you have to make sure that a virgin shell can run the command.

You need to basically be able to start a brand new shell and run that command.

@r39132 r39132 closed this as completed Jun 24, 2015
@r39132
Copy link
Contributor Author

r39132 commented Jun 24, 2015

I'm using the local executor, so I am closing this for now. If I get this again at some later point, I will re-open.

dimberman pushed a commit to dimberman/airflow that referenced this issue Mar 24, 2020
kaxil pushed a commit to dimberman/airflow that referenced this issue Apr 15, 2020
(cherry picked from commit e979162)
(cherry picked from commit 87f2abb)
(cherry picked from commit 06f19c9)
andriisoldatenko pushed a commit to andriisoldatenko/airflow that referenced this issue Sep 21, 2021
(cherry picked from commit e979162)
(cherry picked from commit 87f2abb)
(cherry picked from commit 06f19c9)
(cherry picked from commit 1b52c3a)
(cherry picked from commit e44d171)
(cherry picked from commit 07688f6)
mobuchowski pushed a commit to mobuchowski/airflow that referenced this issue Jan 4, 2022
* Update CONTRIBUTING.md
* adding other profiles

Signed-off-by: Julien Le Dem <julien@apache.org>
rajatsri28 pushed a commit to rajatsri28/airflow that referenced this issue Jan 25, 2022
* EWT-569 : Initial Commit for migrations

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick  76fe7ac from 1.10.4

* CP Contains fb64f2e: [TWTR][AIRFLOW-XXX] Twitter Airflow Customizations + Fixup job scheduling without explicit_defaults_for_timestamp

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick 91d2b00
[CP][EWT-548][AIRFLOW-6527] Make send_task_to_executor timeout configurable (apache#63)

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick 91d2b00
CP contains [EWT-16]: Airflow fix for manual trigger during version upgrade (apache#13)

* [EWT-16]: Airflow fix for manual trigger during version upgrade

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick 91d2b00
[CP][EWT-548][AIRFLOW-6527] Make send_task_to_executor timeout configurable (apache#63)

CP of f757a54

* CP(55bb579) [AIRFLOW-5597] Linkify urls in task instance log (apache#16)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 94cdcf6
[CP] Contains [AIRFLOW-5597] Linkify urls in task instance log

CP of f757a54

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick  4ce8d4c from 1.10.4
CP contains [TWTTR] Fix for rendering code on UI (apache#34)

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick  299b4d8 from 1.10.4
CP contains [TWTR] CP from 1.10+twtr (apache#35)

* 99ee040: CP from 1.10+twtr

* 2e01c24: CP from 1.10.4 ([TWTR][AIRFLOW-4939] Fixup use of fallback kwarg in conf.getint)

* 00cb4ae: [TWTR][AIRFLOW-XXXX] Cherry-pick d4a83bc and bump version (apache#21)

* CP 51b1aee: Relax version requiremets (apache#24)

* CP 67a4d1c: [CX-16266] Change with reference to 1a4c164 commit in open source (apache#25)

* CP 54bd095: [TWTR][CX-17516] Queue tasks already being handled by the executor (apache#26)

* CP 87fcc1c: [TWTR][CX-17516] Requeue tasks in the queued state (apache#27)

* CP 98a1ca9: [AIRFLOW-6625] Explicitly log using utf-8 encoding (apache#7247) (apache#31)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : f7050fb
CP Contains Experiment API path fix (apache#37)

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick  8a689af from 1.10.4
CP Contains Export scheduler env variable into worker pods. (apache#38)

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick  5875a15 from 1.10.4
Cp Contains [EWT-115][EWT-118] Initialise dag var to None and fix for DagModel.fileloc (missed in EWT-16) (apache#39)

* [EWT-569] Airflow Upgrade to 1.10.14, Cherry-Pick  a68e2b3 from 1.10.4
[CX-16591] Fix regex to work with impersonated clusters like airflow_scheduler_ddavydov (apache#42)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : e9642c2
[CP][EWT-128] Fetch task logs from worker pods (19ac45a) (apache#43)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : d5d0a07
[CP][AIRFLOW-6561][EWT-290]: Adding priority class and default resource for worker pod. (apache#47)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 9b58c88
[CP][EWT-302]Patch Pool.DEFAULT_POOL_NAME in BaseOperator (apache#8587) (apache#49)

Open source commit id: b37ce29

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 7b52a71
[CP][AIRFLOW-3121] Define closed property on StreamLogWriter (apache#3955) (apache#52)

CP of 2d5b8a5

* [EWT-361] Fix broken regex pattern for extracting dataflow job id (apache#51)

Update the dataflow URL regex as per AIRFLOW-9323

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 4b5b977
EWT-370: Use python3 to launch the dataflow job. (apache#53)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 596e24f
* [EWT-450] fixing sla miss triggering duplicate alerts every minute (apache#56)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : b3d7fb4
[CP] Handle IntegrityErrors for trigger dagruns & add Stacktrace when DagFileProcessorManager gets killed (apache#57)

CP of faaf179 - from master
CP of 2102122 - from 1.10.12

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : bac4acd
[TWTR][EWT-472] Add lifecycle support while launching worker pods (apache#59)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 6162402
[TWTTR] Don't enqueue tasks again if already queued for K8sExecutor(apache#60)

Basically reverting commit 87fcc1c  and making changes specifically into the Celery Executor class only.

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 1991419
[CP][TWTR][EWT-377] Fix DagBag bug when a Dag has invalid schedule_interval (apache#61)

CP of 5605d10 & apache#11462

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : 48be0f9
[TWTR][EWT-350] Reverting the last commit partially (apache#62)

* [EWT-569] Airflow Upgrade to 1.10.14 [CP] from 1.10.4+twtr : d8c473e
[CP][EWT-548][AIRFLOW-6527] Make send_task_to_executor timeout configurable (apache#63)

CP of f757a54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants