af_task.py 681 B

123456789101112131415161718192021222324252627282930313233
  1. from typing import List, Dict, Optional
  2. from pydantic import BaseModel
  3. class AirflowTaskBase(BaseModel):
  4. name: str
  5. file_urls: Optional[List[str]] = []
  6. script: str
  7. cmd: Optional[str] = ""
  8. cmd_parameters: str
  9. envs: Optional[Dict[str, str]] = {}
  10. run_image: str
  11. class AirflowTaskCreate(AirflowTaskBase):
  12. task_type: str
  13. user_id: int # todo: 后续user id需要根据鉴权 在上写文自动获得
  14. class AirflowTaskUpdate(AirflowTaskBase):
  15. pass
  16. # update_time: int
  17. class AirflowTask(AirflowTaskBase):
  18. id: int
  19. task_type: str
  20. user_id: int
  21. create_time: int
  22. update_time: int
  23. class Config:
  24. orm_mode = True