Skip to content

Handling for Data Preparation actions#1789

Merged
fernst merged 3 commits intomainfrom
add-data-preparation-parsing
Jul 29, 2024
Merged

Handling for Data Preparation actions#1789
fernst merged 3 commits intomainfrom
add-data-preparation-parsing

Conversation

@fernst
Copy link
Copy Markdown
Collaborator

@fernst fernst commented Jul 24, 2024

Add logic to handle Data preparation definitions and parse data preparation YAML into the proto representation of the operation.

…ration YAML into the proto representation of the operation.
@fernst fernst requested a review from Ekrekr July 24, 2024 20:19
config.filename = resolveActionsConfigFilename(config.filename, configPath);
const dataPreparationContents = nativeRequire(config.filename).asJson;
const dataPreparationDefinition = parseDataPreparationDefinitionJson(dataPreparationContents);
this.proto.dataPreparation = dataPreparationDefinition;
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.

Because of protobufjs weirdness, it's better to do:

Suggested change
this.proto.dataPreparation = dataPreparationDefinition;
this.proto.dataPreparation = dataform.DataPreparation.create(dataPreparationDefinition);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The parseDataPreparationDefinitionJson method already returns this dataform.DataPreparation entity.

Comment on lines +22 to +23
// If true, adds the inline assertions of dependencies as direct dependencies for this action.
public dependOnDependencyAssertions: boolean = false;
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.

Supporting this complicates things, and requires a lot more testing area - I'd recommended just not supporting this for now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good, I'll remove this for the time being.

});
});

suite("data_preparations", () => {
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.

Nit:

Suggested change
suite("data_preparations", () => {
suite("data preparations", () => {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated


const EMPTY_NOTEBOOK_CONTENTS = '{ "cells": [] }';

const DATA_PREPARATION_CONTENTS = `
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.

Nit: move this under the suite, or because there's only one test, put it in there.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Moved.

core/session.ts Outdated
Comment on lines +317 to +326

public dataPreparation(name: string): DataPreparation {
const dataPreparation = new DataPreparation();
dataPreparation.session = this;
utils.setNameAndTarget(this, dataPreparation.proto, name);
dataPreparation.proto.fileName = utils.getCallerFile(this.rootDir);
this.actions.push(dataPreparation);
return dataPreparation;
}

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.

I would remove method for support in the JS API - this new method isn't covered under any tests as it is

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 252 to +258
message DataPreparation {
// Data preparatiohs can have more than 1 output
// Used ONLY as an identifiers. All outputs should be listed in the targets
// section.
Target target = 8;
Target canonical_target = 9;

// Data preparations can have more than 1 output
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.

These should be put in the configs.proto file too, or they won't be user overrideable

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Given that the data preparation is self-containing, I don't think this is something that we should allow the user to override.

@fernst fernst requested a review from Ekrekr July 25, 2024 20:30
@fernst fernst merged commit 85f47d4 into main Jul 29, 2024
@fernst fernst deleted the add-data-preparation-parsing branch July 29, 2024 15:48
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