MCPcopy Create free account
hub / github.com/FastLED/FastLED / concurrent_run

Function concurrent_run

ci/util/concurrent_run.py:49–246  ·  view source on GitHub ↗
(
    args: ConcurrentRunArgs,
)

Source from the content-addressed store, hash-verified

47
48
49def concurrent_run(
50 args: ConcurrentRunArgs,
51) -> int:
52 projects = args.projects
53 examples = args.examples
54 skip_init = args.skip_init
55 defines = args.defines
56 customsdk = args.customsdk
57 extra_packages = args.extra_packages
58 build_dir = args.build_dir
59 extra_scripts = args.extra_scripts
60 cwd = args.cwd
61 start_time = time.time()
62 first_project = projects[0]
63 prev_cwd: Optional[str] = None
64 board_dir = args.board_dir
65 libs = args.libs
66 extra_examples: dict[Board, list[Path]] = args.extra_examples or {}
67 if cwd:
68 prev_cwd = os.getcwd()
69 locked_print(f"Changing to directory {cwd}")
70 os.chdir(cwd)
71
72 start_time = time.time()
73 create_build_dir(
74 board=first_project,
75 defines=defines,
76 customsdk=customsdk,
77 no_install_deps=skip_init,
78 extra_packages=extra_packages,
79 build_dir=build_dir,
80 board_dir=board_dir,
81 build_flags=args.build_flags,
82 extra_scripts=extra_scripts,
83 )
84 diff = time.time() - start_time
85
86 msg = f"Build directory created in {diff:.2f} seconds for board"
87 locked_print(msg)
88
89 verbose = args.verbose
90 # This is not memory/cpu bound but is instead network bound so we can run one thread
91 # per board to speed up the process.
92 parallel_init_workers = 1 if not PARRALLEL_PROJECT_INITIALIZATION else len(projects)
93 # Initialize the build directories for all boards
94 locked_print(
95 f"Initializing build directories for {len(projects)} boards with {parallel_init_workers} parallel workers"
96 )
97 with ThreadPoolExecutor(max_workers=parallel_init_workers) as executor:
98 future_to_board: dict[Future[Any], Board] = {}
99 for board in projects:
100 locked_print(
101 f"Submitting build directory initialization for board: {board.board_name}"
102 )
103 future = executor.submit(
104 create_build_dir,
105 board,
106 defines,

Callers 1

mainFunction · 0.90

Calls 13

locked_printFunction · 0.90
create_build_dirFunction · 0.90
cpu_countFunction · 0.90
errors_happenedFunction · 0.90
maxFunction · 0.85
timeMethod · 0.80
doneMethod · 0.80
cancelMethod · 0.80
printFunction · 0.50
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected