Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5fbae20

Browse files
committedOct 14, 2024·
Change run_async() to match run()
1 parent 06cbaa9 commit 5fbae20

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed
 

‎pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ disable = [
2121
"C0115", # missing-class-docstring
2222
"C0116", # missing-function-docstring
2323
"C0301", # line-too-long
24+
"C0302", # too-many-lines
2425
"R0401", # cyclic-import
2526
"R0801", # duplicate-code
2627
"R0902", # too-many-instance-attributes

‎src/ansible_runner/interface.py

+23-2
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,36 @@ def run(config: RunnerConfig | None = None,
221221
return r
222222

223223

224-
def run_async(**kwargs):
224+
def run_async(
225+
config: RunnerConfig | None = None,
226+
streamer: str = "",
227+
debug: bool = False,
228+
logfile: str = "",
229+
ignore_logging: bool = True,
230+
_input: io.FileIO | None = None,
231+
_output: io.FileIO | None = None,
232+
only_transmit_kwargs: bool = False,
233+
**kwargs):
225234
'''
226235
Runs an Ansible Runner task in the background which will start immediately. Returns the thread object and a Runner object.
227236
228237
This uses the same parameters as :py:func:`ansible_runner.interface.run`
229238
230239
:returns: A tuple containing a :py:class:`threading.Thread` object and a :py:class:`ansible_runner.runner.Runner` object
231240
'''
232-
r = init_runner(**kwargs)
241+
242+
# Initialize logging
243+
if not ignore_logging:
244+
output.configure(debug, logfile)
245+
246+
if not config:
247+
config = RunnerConfig(**kwargs)
248+
249+
r = init_runner(
250+
config=config, streamer=streamer,
251+
only_transmit_kwargs=only_transmit_kwargs,
252+
_input=_input, _output=_output,
253+
)
233254
runner_thread = threading.Thread(target=r.run)
234255
runner_thread.start()
235256
return runner_thread, r

0 commit comments

Comments
 (0)
Please sign in to comment.