Skip to content

Conversation

@jpbetz
Copy link
Contributor

@jpbetz jpbetz commented Feb 23, 2022

Add a decorator that checks the context Done() channel every 100 InterpretableCall invocations to halt CEL evaluation when the context is cancelled.

@jpbetz
Copy link
Contributor Author

jpbetz commented Feb 23, 2022

@TristonianJones Curious how you feel about this.

I don't like having to add interpretable nodes here, but that's the existing mechanism so I kept the pattern. Maybe an alternative in the future would be to have a program wide pre|post eval chain that we could put checks like this in.

@TristonianJones
Copy link
Collaborator

@jpbetz In most cases, the halting checks should be isolated to comprehension loops where it's possible to evaluate for a significant period of time. My thought had been to provide a decorator which only affects the evalFold operation. The idea would be similar though. I'll look it over in more detail tomorrow.

@jpbetz
Copy link
Contributor Author

jpbetz commented Mar 1, 2022

I've limited the decoration to the step eval of a fold, I discovered that this requires a panic to early exit because the fold continues to evaluate after the step op returns an error. I don't have a strong opinion on if we should avoid a panic here or not.

@TristonianJones
Copy link
Collaborator

I'm going to close this in favor of #502

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