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

Switching from using model Metadata -> TaskMetadata #298

Merged
merged 3 commits into from
Dec 29, 2020

Conversation

kumare3
Copy link
Contributor

@kumare3 kumare3 commented Dec 29, 2020

TaskMetadata will be maintained as a shadow and allows decoupling of
protocol buffer types from contributor code and user code. This allows
more flexiblity

another prime motivation behind this change is that - it allows making the interface less verbose. This makes it trivial to support default values for metadata.

  TaskMetadata will be maintained as a shadow and allows decoupling of
protocol buffer types from contributor code and user code. This allows
more flexiblity
@wild-endeavor
Copy link
Contributor

I think I'm not seeing the bigger picture. At least I don't understand how this is a decoupling? Ultimately, at serialization time, the Python class will have to be converted into the model class right? I feel like this is more delaying the coupling rather than decoupling.

Which is fine, but I don't understand what this enables. +1 if you want. I think it's okay to use the model sometimes though - like currently we use the dynamic job spec model, literal map and parameter map models, all the literal models, auth, labels, annotations, etc. I don't think we should create parallel classes for all those.

interruptible: Boolean that indicates that this task is of for interruptions and can be scheduled on nodes
with lower QoS guarantees. This will directly reduce the `$`/`execution cost` associated,
at the cost of performance penalties due to potential interruptions
deprecated: This should be used to indicate that the task is deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you provide suggestions for what the value should be? at first glance i would wonder why it's not a bool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its the acutal deprecated message, i kept it as is, but will add a comment

Args:
cache: Boolean that indicates if caching should be enabled
cache_version: Version string to be used for the cached value
interruptible: Boolean that indicates that this task is of for interruptions and can be scheduled on nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

"is of for interruptions" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is just copy pasta, but will fix it

timeout: Optional[Union[datetime.timedelta, int]] = None

def __post_init__(self):
if self.timeout:
Copy link
Contributor

Choose a reason for hiding this comment

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

can you also add a check here if cache is specified but cache_version isn't (and vice-versa)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea

self.timeout = datetime.timedelta(seconds=self.timeout)
elif not isinstance(self.timeout, datetime.timedelta):
raise ValueError("timeout should be duration represented as either a datetime.timedelta or int seconds")
if self.cache and not self.cache_version:
Copy link
Contributor

Choose a reason for hiding this comment

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

what if cache version is set but cache isn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this happens a lot of times today (at lyft)

@katrogan
Copy link
Contributor

can you take a look at test failures?

@kumare3 kumare3 merged commit 770931a into sqlite3-plugin Dec 29, 2020
kumare3 added a commit that referenced this pull request Dec 30, 2020
* Switching from using model Metadata -> TaskMetadata

  TaskMetadata will be maintained as a shadow and allows decoupling of
protocol buffer types from contributor code and user code. This allows
more flexiblity

* addressed comments

* unit test fix
kumare3 added a commit that referenced this pull request Dec 30, 2020
* Switching from using model Metadata -> TaskMetadata (#298)

* Switching from using model Metadata -> TaskMetadata

  TaskMetadata will be maintained as a shadow and allows decoupling of
protocol buffer types from contributor code and user code. This allows
more flexiblity

* addressed comments

* unit test fix

* Formatting fixed
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.

3 participants