Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
47b1315a
Commit
47b1315a
authored
Oct 24, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reinstate Ctrl+C handling
parent
ca4fb043
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
46 deletions
+4
-46
lib/ansible/runner/__init__.py
+4
-46
No files found.
lib/ansible/runner/__init__.py
View file @
47b1315a
...
@@ -57,29 +57,13 @@ multiprocessing_runner = None
...
@@ -57,29 +57,13 @@ multiprocessing_runner = None
################################################
################################################
def
__old__executor_hook
(
job_queue
,
result_queue
):
''' callback used by multiprocessing pool '''
# attempt workaround of https://github.com/newsapps/beeswithmachineguns/issues/17
# this function also not present in CentOS 6
if
HAS_ATFORK
:
atfork
()
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_IGN
)
while
not
job_queue
.
empty
():
try
:
host
=
job_queue
.
get
(
block
=
False
)
result_queue
.
put
(
multiprocessing_runner
.
_executor
(
host
))
except
Queue
.
Empty
:
pass
except
:
traceback
.
print_exc
()
def
_executor_hook
(
host
):
def
_executor_hook
(
host
):
# attempt workaround of https://github.com/newsapps/beeswithmachineguns/issues/17
# attempt workaround of https://github.com/newsapps/beeswithmachineguns/issues/17
# this function also not present in CentOS 6
# this function also not present in CentOS 6
if
HAS_ATFORK
:
if
HAS_ATFORK
:
atfork
()
atfork
()
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_IGN
)
return
multiprocessing_runner
.
_executor
(
host
)
return
multiprocessing_runner
.
_executor
(
host
)
class
HostVars
(
dict
):
class
HostVars
(
dict
):
...
@@ -579,37 +563,11 @@ class Runner(object):
...
@@ -579,37 +563,11 @@ class Runner(object):
# argument but may not be anymore.
# argument but may not be anymore.
p
=
multiprocessing
.
Pool
(
self
.
forks
)
p
=
multiprocessing
.
Pool
(
self
.
forks
)
return
p
.
map
(
_executor_hook
,
hosts
)
OLD_METHOD
=
'''
manager = multiprocessing.Manager()
job_queue = manager.Queue()
[job_queue.put(i) for i in hosts]
result_queue = manager.Queue()
workers = []
for i in range(self.forks):
prc = multiprocessing.Process(target=_executor_hook,
args=(job_queue, result_queue))
prc.start()
workers.append(prc)
try
:
try
:
for worker in workers:
return
p
.
map
(
_executor_hook
,
hosts
)
worker.join()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
for worker in workers:
pool
.
terminate
()
worker.terminate()
raise
errors
.
AnsibleError
(
"Interrupted"
)
worker.join()
results = []
try:
while not result_queue.empty():
results.append(result_queue.get(block=False))
except socket.error:
raise errors.AnsibleError("<interrupted>")
return results
'''
# *****************************************************
# *****************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment