Interface Task

  • All Implemented Interfaces:

    
    public interface Task
    
                        

    A single unit of work executed by Airflow.

    Prefer using the Builder.Task annotation with Builder.Dag to have the annotation processor generate an implementation for you. Only use this interface if you need to do low-level plumbing.

    Implement this interface to define task logic. Airflow instantiates the class via its no-argument constructor, then calls execute once per task-instance run.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Unit execute(Context context, Client client) Executes this task.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • execute

         abstract Unit execute(Context context, Client client)

        Executes this task.

        Any exception thrown marks the task instance as failed. Use client to read connections, variables, pull XComs, or to push an XCom for downstream tasks.

        Parameters:
        context - Runtime context for the current execution workload.
        client - Client for Airflow API calls scoped to this exxecution.