Skip to content

feat: Allow tedge run all to run multiple mappers#4253

Merged
jarhodes314 merged 3 commits into
thin-edge:mainfrom
jarhodes314:feat/run-all-multi-mapper
Jul 20, 2026
Merged

feat: Allow tedge run all to run multiple mappers#4253
jarhodes314 merged 3 commits into
thin-edge:mainfrom
jarhodes314:feat/run-all-multi-mapper

Conversation

@jarhodes314

@jarhodes314 jarhodes314 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Extends the tedge run all CLI to accept multiple arguments in order to run multiple mappers simultaneously, e.g.

tedge run all c8y tb c8y@profile

A bare tedge run all command now runs all mappers defined in /etc/tedge/mappers.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s. You can activate automatic signing by running just prepare-dev once)
  • I ran just format as mentioned in CODING_GUIDELINES
  • I used just check as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.00000% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/core/tedge_mapper/src/lib.rs 92.10% 5 Missing and 4 partials ⚠️
crates/core/tedge/src/supervisor.rs 83.67% 7 Missing and 1 partial ⚠️
crates/common/tedge_supervisor/src/lib.rs 97.29% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread crates/core/tedge/src/supervisor.rs Outdated
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
956 0 7 956 100 3h0m20.037762s

@jarhodes314
jarhodes314 requested a review from a team as a code owner July 14, 2026 14:14
@reubenmiller reubenmiller changed the title Allow tedge run all to run multiple mappers feat: Allow tedge run all to run multiple mappers Jul 14, 2026
@reubenmiller reubenmiller added the skip-release-notes Don't include the ticket in the auto generated release notes label Jul 14, 2026
@jarhodes314
jarhodes314 temporarily deployed to Test Pull Request July 15, 2026 12:46 — with GitHub Actions Inactive
@Bravo555 Bravo555 self-assigned this Jul 15, 2026
@Bravo555
Bravo555 self-requested a review July 15, 2026 13:23

@Bravo555 Bravo555 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran aws and azure mappers without any issue. Very nice that we can run them all in parallel, in a single process! Nice work.
No Robot Framework test, but Rust-based tests seem complete and I guess setting up all the mappers for a Robot Framework test would be a bit annoying, so approving. (though still, I find even some token Robot Framework tests serve as some description of our supported public interface in the absence of more precise documentation)

@Bravo555 Bravo555 removed their assignment Jul 15, 2026

@rina23q rina23q left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. I tested the combination of tedge-mapper-local and tedge-mapper-c8y, it works as expected.

/// this and leave crash recovery to the init system instead: the first unit
/// failure exits the process.
restart_on_crash: bool,
mode: SupervisorMode,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of small improvement is always nice.

@albinsuresh albinsuresh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a fairly major user-facing feature, some system test that starts multiple configured mappers with tedge run all, and the effect of SIGUSR1 that only restarts the mapper units and not the agent unit would have been nice (though there is sufficient unit test coverage). A simple combination like c8y and local would suffice.


/// Returns all `MapperName`s whose cloud URL is configured in `tedge.toml`,
/// plus any user-defined mappers discovered under the `mappers/` directory
pub async fn configured_mappers(config: &TEdgeConfig) -> Vec<MapperName> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existence of a mapper directory with mapper.toml alone (even with the url field in it populated) doesn't always imply that the mapper is ready to be started, as it can be partially configured as well, right? So, don't we need some kind of marker to indicate if a given mapper is "enabled" or not? The user later might want to manually enable/disable a given mapper as well. Any plans to capture that "intent" into the config or as an external marker in the mapper directory?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but I think I would like to solve that more completely further down the line. We probably want to extend tedge run all to support all the long-running components at some point in the future, and I suspect that means we will require some way of defining what "services" should run under tedge run all. I think for now, just running all the mappers with some configuration is a reasonable default behaviour for now. As the interface isn't discoverable via the docs/cli help text, I'm considering this not to be a published API yet, so we can change this behaviour at a later stage anyway.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure sure. I definitely didn't mean that for this PR. I was just curious to know what the plan is. This is definitely a good step forward.

Comment thread crates/core/tedge/src/supervisor.rs Outdated
@jarhodes314
jarhodes314 force-pushed the feat/run-all-multi-mapper branch from fe47904 to 0c873c3 Compare July 17, 2026 13:57
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
@jarhodes314
jarhodes314 force-pushed the feat/run-all-multi-mapper branch from 0c873c3 to 8b996e1 Compare July 17, 2026 13:59
@jarhodes314
jarhodes314 temporarily deployed to Test Pull Request July 17, 2026 13:59 — with GitHub Actions Inactive
@jarhodes314

Copy link
Copy Markdown
Contributor Author

Since this is a fairly major user-facing feature, some system test that starts multiple configured mappers with tedge run all, and the effect of SIGUSR1 that only restarts the mapper units and not the agent unit would have been nice (though there is sufficient unit test coverage). A simple combination like c8y and local would suffice.

I've now added a couple of tests to cover these

@albinsuresh albinsuresh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jarhodes314
jarhodes314 added this pull request to the merge queue Jul 20, 2026
Merged via the queue into thin-edge:main with commit 3229cac Jul 20, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release-notes Don't include the ticket in the auto generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants