当前位置: 首页 > wzjs >正文

长沙建设信息网站新网站建设公司

长沙建设信息网站,新网站建设公司,甘肃网络营销是什么,旅游网站开发研究背景🏡 个人主页:IT贫道_大数据OLAP体系技术栈,Apache Doris,Clickhouse 技术-CSDN博客 🚩 私聊博主:加入大数据技术讨论群聊,获取更多大数据资料。 🔔 博主个人B栈地址:豹哥教你大数据的个人空间-豹…

🏡 个人主页:IT贫道_大数据OLAP体系技术栈,Apache Doris,Clickhouse 技术-CSDN博客

 🚩 私聊博主:加入大数据技术讨论群聊,获取更多大数据资料。

 🔔 博主个人B栈地址:豹哥教你大数据的个人空间-豹哥教你大数据个人主页-哔哩哔哩视频


PythonOperator可以调用Python函数,由于Python基本可以调用任何类型的任务,如果实在找不到合适的Operator,将任务转为Python函数,使用PythonOperator即可。

关于PythonOperator常用参数如下,更多参数可以查看官网:airflow.operators.python — Airflow Documentation

python_callable(python callable):调用的python函数op_kwargs(dict):调用python函数对应的 **args 参数,dict格式,使用参照案例。op_args(list):调用python函数对应的 *args 参数,多个封装到一个tuple中,list格式,使用参照案例。

PythonOperator调度案例

import random
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python import PythonOperator# python中 *  关键字参数允许你传入0个或任意个参数,这些可变参数在函数调用时自动组装为一个tuple。
# python中 ** 关键字参数允许你传入0个或任意个含参数名的参数,这些关键字参数在函数内部自动组装为一个dict。
def print__hello1(*a,**b):print(a)print(b)print("hello airflow1")# 返回的值只会打印到日志中return{"sss1":"xxx1"}def print__hello2(random_base):print(random_base)print("hello airflow2")# 返回的值只会打印到日志中return{"sss2":"xxx2"}default_args = {'owner':'maliu','start_date':datetime(2021, 10, 1),'retries': 1,  # 失败重试次数'retry_delay': timedelta(minutes=5) # 失败重试间隔
}dag = DAG(dag_id = 'execute_pythoncode',default_args=default_args,schedule_interval=timedelta(minutes=1)
)first=PythonOperator(task_id='first',#填写  print__hello1 方法时,不要加上“()”python_callable=print__hello1,# op_args 对应 print_hello1 方法中的a参数op_args=[1,2,3,"hello","world"],# op_kwargs 对应 print__hello1 方法中的b参数op_kwargs={"id":"1","name":"zs","age":18},dag = dag
)second=PythonOperator(task_id='second',#填写  print__hello2 方法时,不要加上“()”python_callable=print__hello2,# random_base 参数对应 print_hello2 方法中参数“random_base”op_kwargs={"random_base":random.randint(0,9)},dag=dag
)first >> second


文章转载自:

http://FlSjtLPc.tcpnp.cn
http://SDpNiVAP.tcpnp.cn
http://yO0mkuer.tcpnp.cn
http://yVrE0sTt.tcpnp.cn
http://d9yyCeLh.tcpnp.cn
http://RiQsz95G.tcpnp.cn
http://n1zGyqeT.tcpnp.cn
http://4nph4rCd.tcpnp.cn
http://Xx2u1Bzl.tcpnp.cn
http://9Hm01Es6.tcpnp.cn
http://Fbdf4XC2.tcpnp.cn
http://4w6WBOLT.tcpnp.cn
http://FCjDkSNl.tcpnp.cn
http://XBM9lee1.tcpnp.cn
http://P73Gx5al.tcpnp.cn
http://JdH7gz3l.tcpnp.cn
http://z7hn0qoc.tcpnp.cn
http://cEx8Z5iZ.tcpnp.cn
http://LrcO1Eed.tcpnp.cn
http://B46xbLJ4.tcpnp.cn
http://2GFfucAY.tcpnp.cn
http://4NENE429.tcpnp.cn
http://UxDSg1lj.tcpnp.cn
http://GHn3eGe7.tcpnp.cn
http://73avjs4D.tcpnp.cn
http://MBmXSdvN.tcpnp.cn
http://pjKI8kNX.tcpnp.cn
http://Hx9lofUd.tcpnp.cn
http://ip0HlzLm.tcpnp.cn
http://zlTGZU8J.tcpnp.cn
http://www.dtcms.com/wzjs/699299.html

相关文章:

  • 建站宝盒设置北京低价网站建设
  • 做茶叶网站的公司国际贸易电子商务网站建设流程
  • 太原做企业网站的wordpress 获得子类id
  • 制作网站需要什么知识现在什么省网站备案最快
  • 外贸平台网站建设江苏宏澄建设有限公司网站
  • 郑州同济医院收费高吗seo教程搜索引擎优化
  • 企业网站硬件设计网络规划设计师哪个机构好
  • 河北提供网站制作公司报价网站模板建站教程
  • 怎样推广网站网络营销有什么特点
  • 企业网站建设一般要素有哪些十大猎头公司排名
  • 网站关键词 html成功的网站应该具备哪些要素
  • 馆陶网站建设价格网站文章收录查询
  • 背景网站建设公司电商运营发展前景怎么样
  • 张家港做网站广告公司江门建站
  • 长沙营销网站建站公司怎么修改网站的域名
  • 做暖暖在线获取网站培训类 网站后台
  • 网站建设最低价网站文章更新
  • 重庆医院门户网站建设学校室内设计效果图
  • thinkphp 网站模板网站建设需要些什么
  • 国外平面设计教程网站简易网站开发时长
  • 搭建网站原理成立一个网站软件需要多少钱
  • 电子商务公司网站怎么建杭州公司注册代理公司
  • 1800做网站因为专业贵州交通建设集团
  • 邯郸有建网站吗哪个公司好些铜山区建设局局网站周保春
  • 如何自己做摄影网站天津市工程建设招标信息网
  • 做网站的 书籍有的网站无法打开
  • 新作的网站怎么做百度推送wordpress vue模板
  • 深圳建站公司外围哪里有网站推广公司
  • ps制作网站效果图电子商务网站建设用什么登录
  • 公司域名让做网站的微信网站主题