selinon / demo-worker

Code for worker used in Selinon demo
https://selinon.readthedocs.io/
MIT License
0 stars 2 forks source link

AttributeError: can't set attribute 'request' #5

Open mynawam opened 2 years ago

mynawam commented 2 years ago

Dear Fridolin,

Hope you're doing great

I was trying to run the demo worker and I am getting the below weird exception if you can point us on the issue? We just synced your demo worker code and wanted to run only the hello world to check how selinon is working

Thanks

selinon-cli -vvv execute --nodes-definition demo_worker/config/nodes.yaml --flow-definitions demo_worker/config/flows/hello.yaml --flow-name hello 64224: [17:44:33] selinon.system from_files:1152: Parsing 'demo_worker/config/nodes.yaml' 64224: [17:44:33] selinon.task init:69: Creating task with name 'HelloTask' import path 'demo_worker.tasks', class name 'HelloTask' 64224: [17:44:33] selinon.flow init:36: Creating flow 'hello' 64224: [17:44:33] selinon.system from_files:1166: Parsing 'demo_worker/config/flows/hello.yaml' 64224: [17:44:33] selinon.system _post_parse_check:809: Post parse check is going to be executed 64224: [17:44:33] selinon.system _check:930: Checking system consistency 64224: [17:44:33] selinon.system _check:949: Storage 'Memory' not used in any flow 64224: [17:44:33] selinon.system _check:949: Storage 'Redis' not used in any flow 64224: [17:44:33] selinon.config set_config_yaml:144: Generating config.py file to created temporary file '/tmp/tmpuswvg6uk' 64224: [17:44:33] selinon.config set_config_py:127: Using config.py file from '/tmp/tmpuswvg6uk' 64224: [17:44:33] selinon.config set_config_yaml:155: Removing generated config.py file '/tmp/tmpuswvg6uk' 64224: [17:44:33] selinon.run run_flow:45: Scheduling flow 'hello' with node_args 'None' on queue 'hello_flow' Traceback (most recent call last): File "/home/mynawam/Desktop/selinon/sel_env/bin/selinon-cli", line 33, in sys.exit(load_entry_point('selinon==1.2.0', 'console_scripts', 'selinon-cli')()) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/click/core.py", line 754, in invoke return __callback(args, **kwargs) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/selinon/cli.py", line 189, in execute executor.run(flow_name, node_args) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/selinon/executor/executor.py", line 108, in run run_flow(flow_name, node_args) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/selinon/run.py", line 47, in run_flow return _do_run_flow(kwargs, queue) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/selinon/run.py", line 22, in _do_run_flow dispatcher_id = Dispatcher().apply_async(kwargs=kwargs, queue=queue) File "/home/mynawam/Desktop/selinon/sel_env/lib64/python3.10/site-packages/selinon/executor/celery_mocks.py", line 113, in simulate_apply_async instance.request = SimulateRequest(instance) AttributeError: can't set attribute 'request'

fridex commented 2 years ago

Hi @mynawam, I'm doing great, I hope you are fine as well.

I suspect this might be caused by a newer celery release. Try to constraint celery<5. The repo has a lock file which states all the requirements for a reproducible runs.

I also see you run python 3.10 - I haven't try it yet.

I am now on a vacation with limited internet access so sorry for possible late answers. Nevertheless, I'll try to do my best to help you.

mynawam commented 2 years ago

Dear Fridolin, Hope you're doing great Thank you for responding, I appreciate your time.

After several tries I kept hitting the same issue even after using your requirements file though sometimes I didn't get this exception, but i couldn't figure out the underlying cause (python , celery version etc..)

I appreciate if you can have another look on it!! Thanks

fridex commented 2 years ago

Checking the code, it looks like you are trying to run selinon CLI to execute a workflow locally. The issue seems to be in setting a property:

https://github.com/celery/celery/blob/b9d949aa9e121140b56df8d11c8c65a7df70a0e2/celery/app/task.py#L1079

It might be a good idea to completelly uninstall celery from your environment. In that case, selinon's logic should use its own Task implementation that should not cause the issue described:

https://github.com/selinon/selinon/blob/8e0787d3e3ba7f76d3b889d88ec9c61267ecc579/selinon/celery.py#L26-L38