Add --no-gpu flag to disable local worker processes

- Added --no-gpu command line flag
- When --no-gpu is specified or no GPUs are detected, local worker processes are not started
- This allows running vidai as a cluster master without local GPU processing
- Useful for dedicated cluster master nodes that only manage remote clients
parent c98a5bf2
......@@ -238,6 +238,12 @@ Examples:
help='Run as cluster client (connects to master instead of starting web interface)'
)
parser.add_argument(
'--no-gpu',
action='store_true',
help='Disable GPU usage and local worker processes (for cluster master mode)'
)
args = parser.parse_args()
# Update config with command line values
......@@ -320,23 +326,27 @@ Examples:
backend_proc.wait()
sys.exit(1)
# Start analysis worker (only if backend is available)
# Determine if we should start local workers
should_start_workers = not args.no_gpu and len(available_backends) > 0
if args.no_gpu:
print("Local worker processes disabled (--no-gpu flag specified)")
elif not available_backends:
print("Local worker processes disabled (no GPUs detected)")
# Start analysis worker (only if we should start workers and backend is available)
analysis_proc = None
if args.analysis_backend in available_backends:
if should_start_workers and args.analysis_backend in available_backends:
analysis_cmd = [sys.executable, '-m', 'vidai.worker_analysis', args.analysis_backend]
analysis_proc = subprocess.Popen(analysis_cmd)
print(f"Started analysis worker for {args.analysis_backend}")
else:
print(f"Skipping analysis worker for {args.analysis_backend} (not available)")
# Start training worker (only if backend is available)
# Start training worker (only if we should start workers and backend is available)
training_proc = None
if args.training_backend in available_backends:
if should_start_workers and args.training_backend in available_backends:
training_cmd = [sys.executable, '-m', 'vidai.worker_training', args.training_backend]
training_proc = subprocess.Popen(training_cmd)
print(f"Started training worker for {args.training_backend}")
else:
print(f"Skipping training worker for {args.training_backend} (not available)")
# Start web process
web_cmd = [sys.executable, '-m', 'vidai.web']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment