You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/06/21 13:43:04 UTC

[GitHub] [airflow] mik-laj commented on issue #16563: executor_config: "limits_memory" option for operators

mik-laj commented on issue #16563:
URL: https://github.com/apache/airflow/issues/16563#issuecomment-865043796


   Why do you think about creating a factory method?
   ````
   def limits(cpu, memory):
       return {
           "pod_override": k8s.V1Pod(
             spec=k8s.V1PodSpec(
               containers=[
                 k8s.V1Container(
                   name="base",
                   resources=k8s.V1ResourceRequirements(
                     limits={
                       "memory": memory,
                       "cpu": cpu
                     }
                  )
                 )
              ]
            )
         )
   ````
   Usage:
   ```
   task1 = PythonOperator(
          task_id="id1",
          python_callable=mycallable,
          dag=dag1,
          executor_config=limits('1', '6Gib')
   )
   ```


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org