Skip to content

Refactor Loader.go, in preparation for adding new trace type.#740

Open
16fb wants to merge 7 commits intovhive-serverless:mainfrom
16fb:main
Open

Refactor Loader.go, in preparation for adding new trace type.#740
16fb wants to merge 7 commits intovhive-serverless:mainfrom
16fb:main

Conversation

@16fb
Copy link
Collaborator

@16fb 16fb commented Mar 3, 2026

Summary

Refactored Loader.
Ensure more clear separation of function parsing/generation, dirigent reading, driver running.

Implementation Notes ⚒️

Added traceInputType variable classification
Combined runRPS() and runTrace() into singular runMode()

Driver should use []*common.function directly, extracted function generation out of driver.
Driver should not handle function read/write to file, extract out of driver.

Dirigent metadata adding extracted out of function generation, takes a dedicated section of runMode()
RPS function generation rewritten to extract dirigent metadata adding out.

External Dependencies 🍀

N/A

Breaking API Changes ⚠️

trace_driver_test had to be updated to use new function specification generation method.
driver.GenerateSpecification() => GenerateAzure2019Specification()

16fb added 2 commits March 3, 2026 18:32
Deprecates GenerateSpecification(), ReadOrWriteFileSpecification() outputIATsToFile()
Replaced with GenerateAzure2019Specification(), ReadOrWriteSpecificationToFile()

Signed-off-by: Bryan Wong <wongwenpingbryan@gmail.com>
Requires each inputType's generator to return a standardised []*common.Function. Vswarn and Dirigent settings left to generator to handle.

Signed-off-by: Bryan Wong <wongwenpingbryan@gmail.com>
16fb added 3 commits March 5, 2026 18:32
Decomponsed RPS function generation (CreateRPSFunctions())
into function creation, and adding dirigent metadata to function.

Extract Dirigent out of GenerateFunction().
Own dedicated section in runMode().

Signed-off-by: Bryan Wong wongwenpingbryan@gmail.com
Signed-off-by: Bryan Wong wongwenpingbryan@gmail.com
Update trace_driver test to work with updated function_specification generation.

Removed unused, deprecated functions.

Added back "FailureConfiguration:" property which was wrongly removed.

Signed-off-by: Bryan Wong wongwenpingbryan@gmail.com
16fb added 2 commits March 5, 2026 23:37
For functions:
  generator.GenerateAzure2019Specification(),
  generator.AppendDirigentMetadata().
Fixed function references,
and to expect []*function to be updated when passed to func.

Signed-off-by: Bryan Wong wongwenpingbryan@gmail.com
Remove shiftIAT and IATDistribution from loader configuration.
Updated driver_tests to not reference the loader struct,
reference the shiftIAT and IATDistribution directly.

Filled up missing fields for loader creation in RunMode().

Signed-off-by: Bryan Wong wongwenpingbryan@gmail.com
@16fb
Copy link
Collaborator Author

16fb commented Mar 5, 2026

Previous 2 commits added your pointers to the PR
The 3 commits before that, fixed the PR automated test popups

Copy link
Contributor

@leokondrashov leokondrashov left a comment

Choose a reason for hiding this comment

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

Quite good now, please fix minor comments and ready to merge

case "Azure2019", "vSwarm":
// Reads Dirigent trace meta-data, and places into *common.Function as property "dirigentMetadata"
// Or if Knative yaml is provided, converts it to dirigent configurations.
// Dirigent metadata parsing
Copy link
Contributor

Choose a reason for hiding this comment

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

please go over the comments you added and prune them. Some of them are really not needed like this "Dirigent metadata parsing" are now redundant.

Comment on lines +228 to +230
LoaderConfiguration: cfg,
FailureConfiguration: config.ReadFailureConfiguration(*failurePath),
DirigentConfiguration: dirigentConfig,
Copy link
Contributor

Choose a reason for hiding this comment

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

did you run through gofmt? it seems weird that cfg got moved by one space but failure confif wasn't

yamlPath := parseYAMLSpecification(cfg)
var functions []*common.Function
var traceParser trace.Parser
func runMode(cfg *config.LoaderConfiguration, readIATFromFile bool, writeIATsToFile bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call it just run at this point

}

func CreateRPSFunctions(cfg *config.LoaderConfiguration, dcfg *config.DirigentConfig, warmFunction common.IATArray, warmFunctionCount []int,
// Generates []*common.Function based on intended warm/cold functionality, does not generate dirigent metadata.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove the part of the comment about what it doesn't do

return result
}

// TODO consider pointer receiver for []*functions
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this one is redundant

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.

2 participants