Skip to content

ENG 2439 add engine and resource to metrics and checks - #1049

Merged
likawind merged 5 commits into
mainfrom
eng-2439-fix-bug-where-metric-and-check-decorator
Mar 7, 2023
Merged

ENG 2439 add engine and resource to metrics and checks#1049
likawind merged 5 commits into
mainfrom
eng-2439-fix-bug-where-metric-and-check-decorator

Conversation

@likawind

@likawind likawind commented Mar 4, 2023

Copy link
Copy Markdown
Contributor

Describe your changes and why you are making these changes

This PR adds engine and resource configs for metrics and checks so that the behavior is consistent to @op() decorators. We simply moved the relevant parts in @op() decorator to a helper function and applies it to both check() and metrics() implementations.

Related issue number (if any)

ENG 2439

Loom demo (if any)

Testing WIP

Checklist before requesting a review

  • I have created a descriptive PR title. The PR title should complete the sentence "This PR...".
  • I have performed a self-review of my code.
  • I have included a small demo of the changes. For the UI, this would be a screenshot or a Loom video.
  • If this is a new feature, I have added unit tests and integration tests.
  • I have run the integration tests locally and they are passing.
  • I have run the linter script locally (See python3 scripts/run_linters.py -h for usage).
  • All features on the UI continue to work correctly.
  • Added one of the following CI labels:
    • run_integration_test: Runs integration tests
    • skip_integration_test: Skips integration tests (Should be used when changes are ONLY documentation/UI)

@likawind
likawind requested review from kenxu95 and vsreekanti March 4, 2023 00:52
@likawind

likawind commented Mar 4, 2023

Copy link
Copy Markdown
Contributor Author

@kenxu95 what's the easiest way to test these changes if I don't have an existing engine set up?

@kenxu95

kenxu95 commented Mar 4, 2023

Copy link
Copy Markdown
Contributor

You can try rebasing on #1046 and running the periodic integration tests manually. Otherwise, I'd recommend setting up your own cluster - it's super easy with Terraform.

@kenxu95 kenxu95 left a comment

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.

Cool! One small refactor request and we should be good to go

Comment thread sdk/aqueduct/decorator.py Outdated
return multiplier * int(memory_scalar_str)


def _update_operator_spec_with_engine_and_resource(

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.

Can we split this into two methods, one for updating engine and one for resources.

Comment thread sdk/aqueduct/decorator.py
def _update_operator_spec_with_engine_and_resource(
spec: OperatorSpec,
engine: Optional[str] = None,
resources: Optional[Dict[str, Any]] = None,

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 wonder if our resource keys should be enums?

SystemMetric *system_metric.SystemMetric `json:"system_metric,omitempty"`

// This can currently only be set for function operators.
// This can currently only be set for operators that has function,

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.

maybe "for function operators, including metrics and checks."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We've been using this in @op so I'd rather keep the same way for now.

@vsreekanti

Copy link
Copy Markdown
Contributor

Quick question on this — is it possible to share the logic for these flags in some way such that we automatically inherit changes between @op, @metric, and @check?

@likawind

likawind commented Mar 7, 2023

Copy link
Copy Markdown
Contributor Author

@vsreekanti good point, it requires us to refactor function decorator to class decorator (and use the inheritance pattern) so I'm putting a linear task for this:

https://linear.app/aqueducthq/issue/ENG-2575/allow-metric-and-check-easily-inherit-op-decorator-inputs

…g-2439-fix-bug-where-metric-and-check-decorator
@likawind

likawind commented Mar 7, 2023

Copy link
Copy Markdown
Contributor Author

Mypy failures are known to happen on other PRs, merging giving it's passing locally.

@likawind
likawind merged commit 286ab9b into main Mar 7, 2023
@likawind
likawind deleted the eng-2439-fix-bug-where-metric-and-check-decorator branch March 8, 2023 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run_integration_test Triggers integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants