import os import argparse import json user_names = [ 'xcl', 'sx', 'pbw', 'jcy', 'wjy', 'wcx' ] user_to_port = { 'pbw': 5002, 'jcy': 5011, 'xcl': 5021, 'sx': 5031, 'wjy': 5041, 'wcx': 5051, } total_data_num = 32016 data_per_user = total_data_num // len(user_names) user_to_data_range = { user: start_idx for user, start_idx in zip( user_names, range(1, total_data_num + 1, data_per_user) ) } def launch(user): if user not in user_names: raise ValueError(f"User {user} not recognized. Available users: {user_names}") port = user_to_port[user] start_idx = user_to_data_range[user] command = f"python annotator/annotate.py --user {user} --port {port} --start_idx {start_idx}" print(f"Launching for user {user} on port {port}") os.system(command) def parse_args(): parser = argparse.ArgumentParser(description="Launch annotation server for a specific user.") parser.add_argument('--user', type=str, required=True, help='Username to launch the server for.') args = parser.parse_args() return args def main(): args = parse_args() launch(args.user) if __name__ == "__main__": main()