我有一个由另一个 dag 触发的 dag。我已经通过DagRunOrder().payload字典以与官方示例相同的方式将一些配置变量传递给了这个 dag 。
现在在这个 dag 中,我有另一个 dagTriggerDagRunOperator来启动第二个 dag,并希望通过这些相同的配置变量。
我已经成功地访问了有效载荷变量,PythonOperator如下所示:
def run_this_func(ds, **kwargs):
print("Remotely received value of {} for message and {} for day".format(
kwargs["dag_run"].conf["message"], kwargs["dag_run"].conf["day"])
)
run_this = PythonOperator(
task_id='run_this',
provide_context=True,
python_callable=run_this_func,
dag=dag
)
Run Code Online (Sandbox Code Playgroud)
但是相同的模式在以下情况下不起作用TriggerDagRunOperator:
def trigger(context, dag_run_obj, **kwargs):
dag_run_obj.payload = {
"message": kwargs["dag_run"].conf["message"],
"day": kwargs["dag_run"].conf["day"]
}
return dag_run_obj
trigger_step = TriggerDagRunOperator(
task_id="trigger_modelling",
trigger_dag_id="Dummy_Modelling",
provide_context=True,
python_callable=trigger,
dag=dag
)
Run Code Online (Sandbox Code Playgroud)
它会产生关于使用的警告provide_context:
INFO - Subtask: /usr/local/lib/python2.7/dist-packages/airflow/models.py:1927: PendingDeprecationWarning: Invalid …Run Code Online (Sandbox Code Playgroud) 我正在使用DESCRIBE关键字来获取有关临时视图的列信息。这是一个有用的方法,但是我有一个表,我只想描述其中的一部分列。我试图LIMIT结合使用DESCRIBE来实现这一点,但无法弄清楚。
这是一个玩具数据集(使用 pyspark 创建):
# make some test data
columns = ['id', 'dogs', 'cats', 'horses', 'people']
vals = [
(1, 2, 0, 4, 3),
(2, 0, 1, 2, 4)
]
# create DataFrame
df = spark.createDataFrame(vals, columns)
df.createOrReplaceTempView('df')
Run Code Online (Sandbox Code Playgroud)
现在用sql来描述:
%%sql
DESCRIBE df
Run Code Online (Sandbox Code Playgroud)
输出:
col_name data_type
id bigint
dogs bigint
cats bigint
horses bigint
people bigint
Run Code Online (Sandbox Code Playgroud)
实际上,我有比这更多的列,我想做的是LIMIT这个查询的输出。以下是我尝试过的一些事情:
尝试#1:
DESCRIBE df
LIMIT 3
Run Code Online (Sandbox Code Playgroud)
错误:
An error was encountered:
"\nextraneous input '3' expecting {<EOF>, '.'}(line …Run Code Online (Sandbox Code Playgroud) 我有一个组,我想向其授予Athena 中一个数据库的权限,同时向同一组CreateTable应用较少的权限,例如对所有数据库的权限。RunQuery是否可以根据具体情况向 Athena 数据库应用权限?
例如,在下面的 IAM 策略中,我想赋予该组在测试数据库中创建和删除表的能力。
来自AWS文档:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"athena:RunQuery",
"athena:StartQueryExecution",
"athena:StopQueryExecution"
],
"Resource": [
"*" // Apply these permissions on all schemas
]
},
{
"Effect": "Allow",
"Action": [
"glue:CreateTable",
"glue:DeleteTable"
],
"Resource": [
"test" // Apply these permissions to only the test database
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我用下面的虚拟表制作了一个简单的闪亮仪表板。当我运行它并且窗口太薄时,表的列越过框的边缘。如果我把窗户弄得足够宽,那么桌子就可以装在盒子里了。
谁能提供更一致的格式帮助?解决方案可能是使框和表具有固定的宽度,使表列的宽度随框的宽度而变化,或者其他原因。
问题的底部是每个状态的屏幕快照,用于说明。
用户界面
library(shinydashboard)
header <- dashboardHeader(title="Dashboard")
sidebar <- dashboardSidebar(sidebarMenuOutput("menu"))
body <- dashboardBody(
tabItems(
tabItem(tabName = "Home",
fluidRow(
column(width = 4,
box(title = "Column 1", width = NULL, solidHeader = TRUE,
tableOutput("Table1")),
box(
title = "Title 1", width = NULL, solidHeader = TRUE,
"Box content")
),
column(width = 4,
box(
title = "Column 2", width = NULL, solidHeader = TRUE,
tableOutput("Table2"))
),
column(width = 4,
box(title = "Column 2", width = NULL, solidHeader = TRUE),
box(title = "Title 3", …Run Code Online (Sandbox Code Playgroud)