+
Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Conversation

Daru-san
Copy link
Owner

@Daru-san Daru-san commented Dec 7, 2024

Introduction

This pull request is a part of my attempt to rethink how this program works.

I had originally planned to have everything run synchronously. However, once I started working on
batch tasks I realized that I need a new way of going about image operations.

Goals

  • Show progress on active image in processing
  • Add verbosity when doing batch tasks
  • Continue processing images when one fails in batch
  • Run multiple image processing tasks in parallel (Dropped)

Time frame

I hope to get this done and released for the next version bump, being v0.2.0.
I have no clue how long it will take, I still have a lot to learn about implementing these features.

This is supposed to get the current state of the app and any tasks that
are currently running. The point is to enable parallel tasks and
advanced batch tasks with progress indicators.
@Daru-san Daru-san self-assigned this Dec 7, 2024
@Daru-san Daru-san added the enhancement New feature or request label Dec 7, 2024
@Daru-san
Copy link
Owner Author

Daru-san commented Dec 9, 2024

Part of my goal is to run multiple image operations in parallel when running in batch mode and prevent individual failures from causing a full on crash.
It would look like this:

load images -> do checks -> create paths -> start image operations (number in parallel can be specified by the user)  ----|
In the event of failure instead of crashing, a message is given to the user showing that *that single image* has failed <-|

@Daru-san
Copy link
Owner Author

Daru-san commented Dec 9, 2024

There would also be a display showing the current and successful image operations (which can be tuned with a verbosity flag)

Example:

Batch convert
--------------------
sand.jpg  [====>      ] Busy
water.jpg [=>         ] Paused
ice.jpg   [=====>     ] Waiting
fire.jpg  [====x      ] Failed
air.jpg   [===========] Done

Conversion is done using the `save_image_format` function, so a separate
module is not necessary
The `transparentize` argument struct does not need to save the image,
much like the other arguments, this lets me do batch operations on each
image.
These changes have been done to prepare for batch operations and
operation tracking.
This function runs operations on single images, only saving them
immediately after the operation is complete or quitting with an error
when a failure occurs
This function should check individual images and do various operations
on them.
As of now the functionality is very incomplete.
I decided to do individual checks instead as it would be easier to track
individual failed images than to group them all at once
This is a bit of an incomplete implementation but the idea is to store
the decoded result of an image in it's respective task element in the
queue.
Once it has been stored we can check if it has failed or not and check
later on.
Then we obtain the paths of the decoded images
At the moment our error handling schemes are not very good and I hope to
improve that, I will attempt to use AnyHow and see how I can integrate
it's functionality into error handling.
Sadly this commit contains many borrow errors and needs to be
re-evaluated.
@Daru-san
Copy link
Owner Author

I have been making good progress on this goal, so far we have a relatively efficient task queue which tracks every task in batch operations.

@Daru-san
Copy link
Owner Author

However, decoding images seems to take up a good chuck of memory, usage jumps as high as 400Mb but shortly after it drops back down to around 60 and fluctuates when processing images.
I will investigate if that is my fault or if it is an issue with the image crate.

Every task that is either failed or completed leaves the
`decoded_tasks()` resultant vector, so we have no need to use the index
obtaining ids
@Daru-san
Copy link
Owner Author

I have decided to split the displaying parts of this PR into another one, this pull is getting really long and I would rather merge everything as is now and then add the feature in another pull.

@Daru-san Daru-san merged commit 0e6af87 into main Dec 12, 2024
5 checks passed
@Daru-san Daru-san mentioned this pull request Dec 12, 2024
3 tasks
@Daru-san Daru-san deleted the feat/app-state branch December 14, 2024 17:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载