Skip to content

feat(cli): jobs commands #19186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

l0ll098
Copy link
Contributor

@l0ll098 l0ll098 commented Jun 15, 2025

Description

Hi, this PR adds a couple of commands in the Immich CLI, to allow users to interact with background jobs directly from within the terminal.

It adds a new jobs command with these subcommands:

  • pause: it stops executions of a given job
  • resume: resumes execution of the given job
  • run: schedules execution of a job instance, given its' name
  • status: prints the status of either all jobs, or of a specific job

With the run command is it also possible to run that job only on:

  • assets that were not previosuly processed (default),
  • on all assets. In this case the force parameter in the corresponding DTO is set to true
  • on all assets, while preserving outputs of previous executions of this job

Also, I've edited documentation pages to describe these new features.

How Has This Been Tested?

This has been manually tested with several combinations of the jobs run, jobs status, jobs pause, and jobs resume commands.
Also, since these commands call the Jobs endpoints exposed by Immich, we can check how these affected the system also using the Immich UI.

Output

Usage: immich jobs [options] [command]

Manage background jobs

Options:
  -h, --help                  display help for command

Commands:
  pause [options] <jobName>   Pause executions of all instances of the given job
  resume [options] <jobName>  Resume executions of all instances of the given job
  run [options] <jobName>     Start a specific job
  status [options] [jobName]  Get the status of all jobs or the status of a specific job
  help [command]              display help for command

Status of all jobs

 node ./cli/dist/index.js jobs status
┌─────────┬────────────────────────────┬───────────────┬───────────────┬─────────────┬────────────────┬─────────────┬──────────────┬──────────────┬─────────────┐
│ (index) │            name            │ isQueueActive │ isQueuePaused │ Active Jobs │ Completed Jobs │ Failed Jobs │ Delayed Jobs │ Waiting Jobs │ Paused Jobs │
├─────────┼────────────────────────────┼───────────────┼───────────────┼─────────────┼────────────────┼─────────────┼──────────────┼──────────────┼─────────────┤
│    0    │   'thumbnailGeneration'    │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    1    │    'metadataExtraction'    │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    2    │     'videoConversion'      │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    3    │       'smartSearch'        │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    4    │ 'storageTemplateMigration' │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    5    │        'migration'         │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    6    │      'backgroundTask'      │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    7    │          'search'          │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    8    │    'duplicateDetection'    │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│    9    │      'faceDetection'       │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│   10    │    'facialRecognition'     │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│   11    │         'sidecar'          │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│   12    │         'library'          │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│   13    │      'notifications'       │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
│   14    │      'backupDatabase'      │     false     │     false     │      0      │       0        │      0      │      0       │      0       │      0      │
└─────────┴────────────────────────────┴───────────────┴───────────────┴─────────────┴────────────────┴─────────────┴──────────────┴──────────────┴─────────────┘

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Copy link
Contributor

github-actions bot commented Jun 15, 2025

Label error. Requires exactly 1 of: changelog:.*. Found: documentation, cli. A maintainer will add the required label.

@github-actions github-actions bot added documentation Improvements or additions to documentation cli Tasks related to the Immich CLI labels Jun 15, 2025
@l0ll098 l0ll098 changed the title Feat/cli jobs commands feat(cli): jobs commands Jun 15, 2025
Copy link
Contributor

github-actions bot commented Jun 15, 2025

📖 Documentation deployed to pr-19186.preview.immich.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Tasks related to the Immich CLI documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant