cloud-custodian / cloud-custodian/cel-python

Are celpy Environments thread safe?

Open
#38 2 comments 0 reactions 0 assignees View on GitHub
documentation help wanted question
Dominant language
Python
Stars
174
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Hello!

I was wondering if a celpy Environment instance could be shared amongst threads, or if we should create a new instance when we want to create a runner for a new expression.

I tried to look through the docs and source code but didn't find any reference to this.

One thing I've noticed though is that, when we call the program method, the code is doing an intermediate assignment to an instance variable of the environment, before returning, which I believe can be problematic in terms of thread preemption.
```
self.runnable = runner_class(self, expr, functions)
return self.runnable
```

Nonetheless I might have missed something and would like to get your feedback on this use case.

Thank you very much!

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names Environment.program and the self.runnable assignment but no file or test. Start by tracing that implementation and searching the documentation and source for existing thread-safety guarantees; exercise shared and per-thread Environment use if coverage is absent. Done means an explicit supported-usage answer, with documentation or a regression test reflecting it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.