Skip to content

Commit 50cc3d0

Browse files
authored
fix(CLI): Address printing incorrect queue name (#109)
1 parent 1661dc7 commit 50cc3d0

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

resolve_proxy_encoder/app/cli.py

+11-13
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,22 @@ def work(
100100
):
101101
"""Prompt to start Celery workers on local machine"""
102102

103-
print("\n")
104-
console.rule(f"[green bold]Start workers[/] :construction_worker:", align="left")
105-
print("\n")
106-
107-
# Print worker queue
108-
109-
ver_colour = "green" if settings["version_info"]["is_latest"] else "yellow"
110-
print(
111-
f"[cyan]Consuming from queue: [/][{ver_colour}]'{settings['version_info']['commit_short_sha']}'[/]"
112-
)
113-
114103
if not workers_to_launch:
115104
workers_to_launch = 0
116105

106+
print("\n")
107+
117108
if workers_to_launch > 0:
118-
print(f"[green]Starting workers! :construction_worker:[/]")
109+
console.rule(
110+
f"[green bold]Starting workers![/] :construction_worker:", align="left"
111+
)
119112
else:
120-
print(f"[cyan]Starting worker launcher prompt :construction_worker:[/]")
113+
console.rule(
114+
f"[green bold]Starting worker launcher prompt[/] :construction_worker:",
115+
align="left",
116+
)
117+
118+
print("\n")
121119

122120
from ..worker import launch_workers
123121

resolve_proxy_encoder/worker/launch_workers.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def get_new_console():
171171
)
172172

173173

174-
def launch_workers(workers_to_launch: int):
174+
def launch_workers(workers_to_launch: int, queue_name: str):
175175

176176
# Start launching
177177

@@ -186,17 +186,24 @@ def main(workers: int = 0):
186186
os_ = platform.system()
187187
cpu_cores = multiprocessing.cpu_count()
188188

189+
queue_name = get_queue()
190+
if not queue_name:
191+
raise TypeError("Couldn't get queue!")
192+
193+
print()
194+
logger.info(f"[cyan]Consuming from queue: '{queue_name}'\n")
195+
189196
# Don't bother with tips if not prompting
190197
if workers:
191198

192-
launch_workers(workers)
199+
launch_workers(workers, queue_name)
193200

194201
else:
195202

196203
print(f"[green]Running on {os_} with {cpu_cores} cores.[/]\n")
197204
print("For maximum performance, start as many workers as CPU cores.")
198205
print("Default recommendation is 2 cores spare for Resolve and other tasks.\n")
199-
launch_workers(prompt_worker_amount(cpu_cores))
206+
launch_workers(prompt_worker_amount(cpu_cores), queue_name)
200207

201208
print(f"[green]Done![/]")
202209
core.app_exit(0, 5)

resolve_proxy_encoder/worker/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_queue():
5151

5252
logger.warning(
5353
"[yellow]Version constrain is disabled!\n"
54-
+ "You [bold]must[/] ensure routing and version compatability yourself!"
54+
"You [bold]must[/] ensure routing and version compatability yourself!"
5555
)
5656

5757
return "celery"

0 commit comments

Comments
 (0)