def run(self, arguments, settings, app):
aiotask_context.set('request', self.request)
script = os.path.abspath(arguments.script)
spec = importlib.util.spec_from_file_location("module.name", script)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
if not hasattr(module, 'run'):
logger.warn(f'Not `async def run()` function found in file {script}')
return
sig = inspect.signature(module.run)
if 'container' in sig.parameters:
async for txn, tm, container in get_containers(self.request):
await module.run(container)
await tm.commit(txn=txn)
else:
await lazy_apply(module.run, app)
评论列表
文章目录