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

Handling for Data Preparation actions #1789

Merged
merged 3 commits into from
Jul 29, 2024
Merged

Conversation

fernst
Copy link
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
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
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
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
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.

@@ -858,6 +892,123 @@ defaultNotebookRuntimeOptions:
});
});

suite("data_preparations", () => {
Copy link
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
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@@ -57,6 +57,40 @@ class TestConfigs {

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

const DATA_PREPARATION_CONTENTS = `
Copy link
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
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
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
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
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
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
4 checks passed
@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