Skip to content

Commit

Permalink
Reduce max_worker size on generate_test_data script to address issues…
Browse files Browse the repository at this point in the history
… on Windows CI.
  • Loading branch information
StefanoLusardi committed Aug 3, 2024
1 parent a04acfe commit 415e73c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
28 changes: 14 additions & 14 deletions ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ jobs:
# ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate'
# INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg'

# ubuntu2204_gcc12:
# AGENT: 'ubuntu-22.04'
# COMPILER: gcc
# COMPILER_VERSION: 12
# SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)'
# ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate'
# INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg'
ubuntu2204_gcc12:
AGENT: 'ubuntu-22.04'
COMPILER: gcc
COMPILER_VERSION: 12
SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)'
ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate'
INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg'

# ubuntu2204_clang15:
# AGENT: 'ubuntu-22.04'
# COMPILER: clang
# COMPILER_VERSION: 15
# SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)'
# ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate'
# INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg'
ubuntu2204_clang15:
AGENT: 'ubuntu-22.04'
COMPILER: clang
COMPILER_VERSION: 15
SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)'
ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate'
INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg'

macos14_clang15:
AGENT: 'macOS-14'
Expand Down
15 changes: 8 additions & 7 deletions scripts/tests/generate_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
APPLICATION_NAME = "Test data generator"


def parse():
parser = argparse.ArgumentParser(APPLICATION_NAME, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--directory", help="Directory where output files will be generated", required=False, default=pathlib.Path("data"))
parser.add_argument("--executable", help='Path to the ffmpeg executable', required=False, default='ffmpeg')
return parser.parse_args()

def ffmpeg_generate_video_commands(ffmpeg_executable, output_dir, video_formats):
commands = []
for format in video_formats:
Expand All @@ -48,12 +54,6 @@ def ffmpeg_generate_video_commands(ffmpeg_executable, output_dir, video_formats)

return commands

def parse():
parser = argparse.ArgumentParser(APPLICATION_NAME, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--directory", help="Directory where output files will be generated", required=False, default=pathlib.Path("data"))
parser.add_argument("--executable", help='Path to the ffmpeg executable', required=False, default='ffmpeg')
return parser.parse_args()

def create_file(cmd):
print(cmd)

Expand Down Expand Up @@ -88,13 +88,14 @@ def main():

check_executable(executable)

with concurrent.futures.ThreadPoolExecutor(max_workers=sys.maxsize) as executor:
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
commands = ffmpeg_generate_video_commands(executable, output_dir, video_formats)
futures = {executor.submit(create_file, cmd): cmd for cmd in commands}
for future in concurrent.futures.as_completed(futures):
if future.result() != 0:
print(f"Error running {APPLICATION_NAME} - Execution finished")
return future.result()

print(f"{APPLICATION_NAME} - Execution finished")
return 0

Expand Down

0 comments on commit 415e73c

Please sign in to comment.