From 77d1db8e8630de8822c124eb39f4cd817ed1d3e1 Mon Sep 17 00:00:00 2001 From: Julius Unverfehrt Date: Mon, 11 Jul 2022 13:07:41 +0200 Subject: [PATCH] add operation assignment via config if operation is not defined by caller --- config.yaml | 4 ++-- pyinfra/component_factory.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index e57728c..592d0e2 100755 --- a/config.yaml +++ b/config.yaml @@ -4,8 +4,8 @@ service: response_formatter: default # formats analysis payloads of response messages upload_formatter: projecting # formats analysis payloads of objects uploaded to storage # Note: This is not really the right place for this. It should be configured on a per-service basis. - operation: default -# operation: image_classification # FIXME: operation needs to be specified in deployment config for services that are called without an operation specified + operation: $OPERATION|default + # operation needs to be specified in deployment config for services that are called without an operation specified operations: conversion: input: diff --git a/pyinfra/component_factory.py b/pyinfra/component_factory.py index 85727b1..02697b1 100644 --- a/pyinfra/component_factory.py +++ b/pyinfra/component_factory.py @@ -107,6 +107,8 @@ class ComponentFactory: @lru_cache(maxsize=None) def get_operation2file_patterns(self): + if self.config.service.operation is not "default": + self.config.service.operations["default"] = self.config.service.operations[self.config.service.operation] return self.config.service.operations @lru_cache(maxsize=None)