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

Clean up storm runtime scopes and implement readonly runtime feature #1869

Merged
merged 20 commits into from Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions synapse/cortex.py
Expand Up @@ -2988,6 +2988,18 @@ def getStormQuery(self, text, mode='storm'):
query.init(self)
return query

@contextlib.asynccontextmanager
async def getStormRuntime(self, query, opts=None):

opts = self._initStormOpts(opts)

view = self._viewFromOpts(opts)
user = self._userFromOpts(opts)

async with await self.snap(user=user, view=view) as snap:
with snap.getStormRuntime(query, opts=opts, user=user) as runt:
yield runt

async def reqValidStorm(self, text, opts=None):
'''
Parse a storm query to validate it.
Expand Down