Skip to content

🐞 Elixir/Rust/Python: strange experimentalWithAllGPUs function name #6310

Closed

Description

@wingyplus

What is the issue?

See https://hexdocs.pm/dagger/Dagger.Container.html#experimental_with_all_gp_us/1. The function name should be experimental_with_all_gpus, experimental_with_all_gp_us

Dagger version

dagger v0.9.4

Steps to reproduce

No response

Log output

No response

Activity

  1. jedevc commented on Jan 16, 2024

    @jedevc
    Contributor

    cc @vito since you've been in the graphql schema space 😄

    I think this is some weirdness with how the string conversion library we use works, GPUs gets split into GP+Us instead of keeping it as is.

  2. vito commented on Jan 16, 2024

    @vito
    Contributor

    My guess is we need to use strcase.ConfigureAcronym

  3. wingyplus commented on Jan 16, 2024

    @wingyplus
    ContributorAuthor
  4. jedevc commented on Jan 26, 2024

    @jedevc
    Contributor

    Eek we also have this issue in python (cc @helderco):

    def experimental_with_all_gp_us(self) -> "Container":

    Poked into this - it looks like this is left up to the SDK codegen to convert, the input at the point of generation is experimentalWithAllGPUs.

    In the rust case (which I'm more familiar with), this function performs the incorrect conversion:

    pub fn format_struct_name(s: &str) -> String {
    s.to_case(Case::Snake)
    }

    Super weird though, because, if I change the code slightly:

    pub fn format_struct_name(s: &str) -> String {
        let conv = Converter::new()
            .remove_boundary(Boundary::Acronym)
            .to_case(Case::Snake);
        conv.convert(s)
    }

    Then I get:

    diff --git a/sdk/rust/crates/dagger-sdk/src/gen.rs b/sdk/rust/crates/dagger-sdk/src/gen.rs
    index 7aa880b6e..5f9803f3c 100644
    --- a/sdk/rust/crates/dagger-sdk/src/gen.rs
    +++ b/sdk/rust/crates/dagger-sdk/src/gen.rs
    @@ -929,7 +929,7 @@ impl Container {
         /// EXPERIMENTAL API! Subject to change/removal at any time.
         /// Configures all available GPUs on the host to be accessible to this container.
         /// This currently works for Nvidia devices only.
    -    pub fn experimental_with_all_gp_us(&self) -> Container {
    +    pub fn experimental_with_all_gpus(&self) -> Container {
             let query = self.selection.select("experimentalWithAllGPUs");
             return Container {
                 proc: self.proc.clone(),
    @@ -3195,7 +3195,7 @@ impl GeneratedCode {
             query.execute(self.graphql_client.clone()).await
         }
         /// Set the list of paths to mark generated in version control.
    -    pub fn with_vcs_generated_paths(&self, paths: Vec<impl Into<String>>) -> GeneratedCode {
    +    pub fn with_vcsgenerated_paths(&self, paths: Vec<impl Into<String>>) -> GeneratedCode {
             let mut query = self.selection.select("withVCSGeneratedPaths");
             query = query.arg(
                 "paths",
    @@ -3208,7 +3208,7 @@ impl GeneratedCode {
             };
         }
         /// Set the list of paths to ignore in version control.
    -    pub fn with_vcs_ignored_paths(&self, paths: Vec<impl Into<String>>) -> GeneratedCode {
    +    pub fn with_vcsignored_paths(&self, paths: Vec<impl Into<String>>) -> GeneratedCode {
             let mut query = self.selection.select("withVCSIgnoredPaths");
             query = query.arg(
                 "paths",

    It seems like when we transform to camel case, you can't have both:

    • "VCSIgnore" -> "VCS" "Ignore"
    • "GPUs" -> "GPUs"
  5. changed the title [-]🐞 Elixir: strange experimentalWithAllGPUs function name[/-] [+]🐞 Elixir/Rust/Python: strange experimentalWithAllGPUs function name[/+] on Jan 26, 2024
  6. vito commented on Jan 26, 2024

    @vito
    Contributor

    Welp. Maybe it's time to just stop using acronyms?

    • WithVCSIgnoredPaths => WithIgnoredCodePaths
    • WithVCSGeneratedPaths => WithGeneratedCodePaths
    • ExperimentalWithAllGPUs => ExperimentalWithAllGraphicsDevices

    We could alternatively maintain a bespoke list of acronyms and hope each language has a library that supports that sort of thing, but keeping that in sync across SDKs seems like it'd be a constant battle.

  7. wingyplus commented on Jan 28, 2024

    @wingyplus
    ContributorAuthor

    Welp. Maybe it's time to just stop using acronyms?

    • WithVCSIgnoredPaths => WithIgnoredCodePaths
    • WithVCSGeneratedPaths => WithGeneratedCodePaths
    • ExperimentalWithAllGPUs => ExperimentalWithAllGraphicsDevices

    We could alternatively maintain a bespoke list of acronyms and hope each language has a library that supports that sort of thing, but keeping that in sync across SDKs seems like it'd be a constant battle.

    Or we could use acronym word with a camel case, such as experimentalWithAllGPUs -> experimentalWithAllGpus. I’m not sure if it make sense to some language such as Go or Java that uses camel case style but it solve on snake case function like this issue.

  8. jedevc commented on Jan 29, 2024

    @jedevc
    Contributor

    We could alternatively maintain a bespoke list of acronyms

    Even more alternatively, could we potentially add a method to the dagger API that performs the word splitting? Then each SDK joins them up? That way, we only need to handle this complexity in the Go SDK.

    Though the issue with that is that the SDKs are using the graphql introspection API - so not 100% sure about that, if we were instead using the fancy new TypeDefs API, it would be super easy to add into that.

    Just another option to add to the pile 🎉

  9. helderco commented on Jan 29, 2024

    @helderco
    Contributor

    Yeah, that's my plan with:

    Need to update the description, but have been thinking on modularizing it.

  10. locked and limited conversation to collaborators on Mar 24, 2026
  11. converted this issue into a discussion #12403 on Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions