You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have included the output of celery -A proj report in the issue.
software -> celery:4.0.2 (latentcall) kombu:4.0.2 py:3.6.0
billiard:3.5.0.2 py-amqp:2.1.4
platform -> system:Darwin arch:64bit imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:amqp results:django-db).
I have verified that the issue exists against the master branch of Celery.
import logging
from .Logger import Logger
from django.conf import settings
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
from ansible.playbook.play import Play
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.plugins.callback import CallbackBase
3.tasks.pyfrom future import absolute_import, unicode_literals
from celery import shared_task
from .deploy_tomcat2 import django_process
#rom celery.contrib import rdb
@shared_task
def deploy(num):
#return 'hello world {0}'.format(num)
#rdb.set_trace()
return django_process(num)`
Expected behavior
In django console :python manage.py shell , I can use deploy('123') ,code call ansibleApi to copy abc.sh to dst server sucessfully.
But I didn't work when I used 'deploy.apply_async(args=['1334'], queue='queue.ops.deploy', routing_key='ops.deploy')'
there are two method to solve this problem ,disable assert:
1.where celery starts set export PYTHONOPTIMIZE=1 OR start celery with this parameter -O OPTIMIZATION
2.disable python packet multiprocessing process.py line 102: assert not _current_process._config.get('daemon'), \ 'daemonic processes are not allowed to have children'
there are two method to solve this problem ,disable assert:
1.where celery starts set export PYTHONOPTIMIZE=1 OR start celery with this parameter -O OPTIMIZATION
2.disable python packet multiprocessing process.py line 102:
assert not _current_process._config.get('daemon'), \ 'daemonic processes are not allowed to have children'
@Xuexiang825 Sorry, it doesn't work, I use Python 3.6.3 and ansible 2.4.2.0, celery 4.1.0. My playbook executer display message but do nothing.Furthermore, can you tell me something about parameter -O OPTIMIZATION?
Checklist
celery -A proj report
in the issue.software -> celery:4.0.2 (latentcall) kombu:4.0.2 py:3.6.0
billiard:3.5.0.2 py-amqp:2.1.4
platform -> system:Darwin arch:64bit imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:amqp results:django-db).
master
branch of Celery.Steps to reproduce
1 .deploy_tomcat2.py
`from .AnsibleApi import CallApi
def django_process(jira_num):
server = '10.10.51.30'
name = 'abc'
port = 11011
code = 'efs'
jdk = '1.12.13'
jvm = 'xxxx'
2. AnsibleApi.py
#!/usr/bin/env python-- coding: utf-8 --
import logging
from .Logger import Logger
from django.conf import settings
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
from ansible.playbook.play import Play
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.plugins.callback import CallbackBase
Log = Logger('/tmp/auto_deploy_tomcat.log',logging.INFO)
class ResultCallback(CallbackBase):
def init(self, *args, **kwargs):
super(ResultCallback ,self).init(*args, **kwargs)
self.host_ok = {}
self.host_unreachable = {}
self.host_failed = {}
class CallApi(object):
user = settings.SSH_USER
ssh_private_key_file = settings.SSH_PRIVATE_KEY_FILE
results_callback = ResultCallback()
Options = namedtuple('Options',
['connection', 'module_path', 'private_key_file', 'forks', 'become', 'become_method',
'become_user', 'check'])
3.tasks.py
from future import absolute_import, unicode_literalsfrom celery import shared_task
from .deploy_tomcat2 import django_process
#rom celery.contrib import rdb
@shared_task
def deploy(num):
#return 'hello world {0}'.format(num)
#rdb.set_trace()
Expected behavior
In django console :python manage.py shell , I can use deploy('123') ,code call ansibleApi to copy abc.sh to dst server sucessfully.
But I didn't work when I used 'deploy.apply_async(args=['1334'], queue='queue.ops.deploy', routing_key='ops.deploy')'
I searched a few day ,still doesn't work out .
Actual behavior
AnsibleApi return empty dict :{'success': {}, 'failed': {}, 'unreachable': {}}
The text was updated successfully, but these errors were encountered: