Skip to content

Improve CompileResponse#progress behavior #2016

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

Closed
3 tasks done
dankeboy36 opened this issue Dec 18, 2022 · 0 comments · Fixed by #2225
Closed
3 tasks done

Improve CompileResponse#progress behavior #2016

dankeboy36 opened this issue Dec 18, 2022 · 0 comments · Fixed by #2225
Assignees
Labels
topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project

Comments

@dankeboy36
Copy link
Contributor

dankeboy36 commented Dec 18, 2022

Describe the problem

When I execute a gRPC CompileRequest, the progress starts twice and completed is always false.

To reproduce

my_sketch.ino:

void setup() {}
void loop() {}

void foo() {}
int foo2 = 1;

Have the following request:

{
    "fqbn": "arduino:avr:uno",
    "sketchPath": "/Users/XXX/Desktop/dev/__trash/my_sketch",
    "instance": {
        "id": 1
    }
}

You get the following responses:

[
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 0.2232142835855484
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 0.4464285671710968
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 0.6696428656578064
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 0.8928571343421936
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 1.1160714626312256
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 1.3392857313156128
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 1.5625
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 1.7857142686843872
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 2.0089285373687744
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 2.232142925262451
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 2.455357313156128
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 2.6785717010498047
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 3.125
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 6.25
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 9.375
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 12.5
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 15.625
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 18.75
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 21.875
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 25
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 28.125
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 31.25
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 31.25
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 34.375
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 37.5
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 40.625
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 40.625
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 43.75
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 46.875
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 50
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 53.125
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 56.25
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 59.375
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 62.5
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 65.625
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 68.75
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 71.875
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 75
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 78.125
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 81.25
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 84.375
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 87.5
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 90.625
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 93.75
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 96.875
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 100
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 25
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 50
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 75
        }
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": [],
        "progress": {
            "name": "",
            "message": "",
            "completed": false,
            "percent": 100
        }
    },
    {
        "outStream": {
            "type": "Buffer",
            "data": [
                83,
                107,
                101,

                46,
                10
            ]
        },
        "errStream": {},
        "buildPath": "",
        "usedLibraries": [],
        "executableSectionsSize": []
    },
    {
        "outStream": {},
        "errStream": {},
        "buildPath": "/private/var/folders/g0/n_2cw4ds44l2abcv39xrc4340000gp/T/arduino-sketch-XXX",
        "usedLibraries": [],
        "executableSectionsSize": [
            {
                "name": "text",
                "size": 444,
                "maxSize": 32256
            },
            {
                "name": "data",
                "size": 9,
                "maxSize": 2048
            }
        ],
        "boardPlatform": {
            "id": "arduino:avr",
            "version": "1.8.5",
            "installDir": "/Users/XXX/Library/Arduino15/packages/arduino/hardware/avr/1.8.5",
            "packageUrl": ""
        },
        "buildPlatform": {
            "id": "arduino:avr",
            "version": "1.8.5",
            "installDir": "/Users/XXX/Library/Arduino15/packages/arduino/hardware/avr/1.8.5",
            "packageUrl": ""
        }
    }
]

Notes:

  • I wrapped all responses into an array for better JSON format.
  • I edited the original data buffer to have smaller JSON, the build path hash, and the install paths in the output.

Expected behavior

  • progress#percent should not reach 100 twice. If it can, then they're multiple tasks. Please use TaskProgress#name and TaskProgress#message to distinguish.
  • When a task completes, completed is true.
  • A documentation of how the CompileResponse properties are set or how the responses are ordered would be helpful. Or use oneof for the response messages to formally define the API behavior. Thanks!

Arduino CLI version

0.29.0 76251df

Operating system

macOS

Operating system version

11.6.5

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@dankeboy36 dankeboy36 added the type: imperfection Perceived defect in any part of project label Dec 18, 2022
@per1234 per1234 added topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface labels Dec 18, 2022
@cmaglie cmaglie added this to the Arduino CLI 1.0 milestone Jun 9, 2023
@alessio-perugini alessio-perugini self-assigned this Jun 23, 2023
@alessio-perugini alessio-perugini linked a pull request Jun 23, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants