Skip to content

Commit

Permalink
Remove the future from the tracking list once completed
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Feb 2, 2024
1 parent 97f2f32 commit a9c8e11
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/kolibri2zim/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ def parse_args(raw_args):
type=int,
)

parser.add_argument(
"--processes",
help="Number of processes to dedicate to media optimizations. "
"Defaults to number of available CPU threads visible minus 1 except when run "
"inside a container (Docker) where we default to 1 as the detected CPUs are "
f"the ones of the host. Default: {Global.nb_available_cpus}",
default=Global.nb_available_cpus,
type=int,
)

parser.add_argument(
"--optimization-cache",
help="URL with credentials to S3 for use as optimization cache",
Expand Down
5 changes: 5 additions & 0 deletions src/kolibri2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,14 @@ def create_video_processing_job(
path=path,
preset=preset,
)
future.add_done_callback(self.clean_videos_futures)

Check warning on line 486 in src/kolibri2zim/scraper.py

View check run for this annotation

Codecov / codecov/patch

src/kolibri2zim/scraper.py#L486

Added line #L486 was not covered by tests
# Keep future to track status
self.videos_futures.append(future)

Check warning on line 488 in src/kolibri2zim/scraper.py

View check run for this annotation

Codecov / codecov/patch

src/kolibri2zim/scraper.py#L488

Added line #L488 was not covered by tests

def clean_videos_futures(self, future):
# Remove future now that it has finished
self.videos_futures.remove(future)

Check warning on line 492 in src/kolibri2zim/scraper.py

View check run for this annotation

Codecov / codecov/patch

src/kolibri2zim/scraper.py#L492

Added line #L492 was not covered by tests

def convert_and_add_video(
self, file_id, src_fpath, src_checksum, dest_fpath, path, preset
):
Expand Down

0 comments on commit a9c8e11

Please sign in to comment.