Skip to content
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

pubsys: switch to tough async #98

Merged
merged 1 commit into from
Nov 28, 2023
Merged

Conversation

webern
Copy link
Contributor

@webern webern commented Oct 6, 2023

Issue #, if available:

Description of changes:

Use the new async version of tough and tuftool

Testing

  • make variant
  • make ami
  • make repo
  • verify repo
  • re-sign repo

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@bcressey bcressey left a comment

Choose a reason for hiding this comment

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

For the full async conversion, we'll want to look at replacing std with tokio in several spots:

  • std::io
  • std::fs
  • std::process

For example, upload-ova uses a std-process to run govc inside a container. That's not going to do the executor any favors.

tools/pubsys/src/repo.rs Outdated Show resolved Hide resolved
tools/pubsys/src/repo/validate_repo/mod.rs Outdated Show resolved Hide resolved
tools/pubsys/src/repo/validate_repo/mod.rs Outdated Show resolved Hide resolved
tools/pubsys/src/main.rs Show resolved Hide resolved
@webern
Copy link
Contributor Author

webern commented Oct 10, 2023

@webern
Copy link
Contributor Author

webern commented Oct 10, 2023

@webern
Copy link
Contributor Author

webern commented Nov 8, 2023

tools/pubsys/Cargo.toml Outdated Show resolved Hide resolved
tools/pubsys/src/aws/publish_ami/mod.rs Outdated Show resolved Hide resolved
tools/pubsys/src/main.rs Outdated Show resolved Hide resolved
@webern
Copy link
Contributor Author

webern commented Nov 21, 2023

@webern webern marked this pull request as ready for review November 21, 2023 19:42
@webern webern mentioned this pull request Nov 22, 2023
7 tasks
@webern webern requested a review from ecpullen November 27, 2023 17:23
Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

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

Nice! 🥇

Copy link
Contributor

@cbgbt cbgbt left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, nice work. I only have one concern.

let _permit = cloned_sem.acquire().await.context(error::SemaphoreSnafu)?;
download_target(cloned_repo, cloned_target).await
};
tasks.spawn(fut);
Copy link
Contributor

Choose a reason for hiding this comment

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

This could spawn an unbounded number of tasks. Before reading this code, my understanding was that if we are using the multi-threaded runtime this could therefor result in an unbounded number of OS threads being spawned. After re-reading the runtime docs it seems like the number of OS threads is bound to the number of CPU cores.

In the past I've used buffered_unordered to limit the number of tasks as well, which seems slightly safer but it is certainly more complex.

Copy link
Contributor

@ecpullen ecpullen left a comment

Choose a reason for hiding this comment

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

LGTM other than Sean's comment

@webern
Copy link
Contributor Author

webern commented Nov 28, 2023

@webern
Copy link
Contributor Author

webern commented Nov 28, 2023

Copy link
Contributor

@cbgbt cbgbt left a comment

Choose a reason for hiding this comment

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

Nice 🚀

@webern webern merged commit 302ef13 into bottlerocket-os:develop Nov 28, 2023
1 check passed
@webern webern deleted the tough-async branch November 28, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test and use tough async
5 participants