geraj1010 commented on code in PR #41416:
URL: https://github.com/apache/airflow/pull/41416#discussion_r1715955116


##########
airflow/providers/docker/operators/docker_swarm.py:
##########
@@ -128,12 +140,25 @@ def __init__(
         self.networks = networks
         self.placement = placement
         self.container_resources = container_resources or 
types.Resources(mem_limit=self.mem_limit)
+        self.logging_driver = logging_driver
+        self.logging_driver_opts = logging_driver_opts
 
     def execute(self, context: Context) -> None:
         self.environment["AIRFLOW_TMP_DIR"] = self.tmp_dir
         return self._run_service()
 
     def _run_service(self) -> None:
+        if self.logging_driver:
+            logging_driver = self.logging_driver.lower()
+            supported_logging_drivers = ["json-file", "gelf"]
+            if logging_driver not in supported_logging_drivers:
+                raise AirflowException(
+                    f"Unsupported logging driver provided: {logging_driver}. 
Must be one of: [{', '.join(supported_logging_drivers)}]"
+                )
+            log_driver = types.DriverConfig(logging_driver, 
self.logging_driver_opts)

Review Comment:
   That's not a bad idea, since I don't think we would want the operator object 
to be created if there is any invalid arguments. I have made the update and 
moved the validation to init.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to