小编Ble*_*ssy的帖子

如何在 Stackdriver Alerting 中自定义整个电子邮件通知?

目前,创建警报策略时在文档字段中指定的消息显示在 Stackdriver 警报电子邮件的文档字段中。我想用我的自定义内容覆盖整个电子邮件正文。如何使用自定义消息覆盖 Stackdriver Alert 电子邮件的消息正文?有没有其他解决方法可以做到这一点?

google-cloud-platform stackdriver google-cloud-monitoring

6
推荐指数
1
解决办法
1442
查看次数

Airflow + Nginx 设置给出 Airflow 404 = 很多圆圈

我正在尝试使用此处给出的说明在 nginx 后面设置 Airflow。

气流.cfg 文件

base_url = https://myorg.com/airflow
web_server_port = 8081
.
.
.
enable_proxy_fix = True
Run Code Online (Sandbox Code Playgroud)

nginx配置

server {
    listen 443 ssl http2 default_server;
    server_name myorg.com;
    .
    .
    .
    location /airflow {
        proxy_pass http://localhost:8081;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-Proto "https";
    }
}
Run Code Online (Sandbox Code Playgroud)

Airflow Web 服务器和调度程序已启动并作为 systemd 运行。当我尝试访问https://myorg.com/airflow/时,它给出了 Airflow 404 = 很多圆圈。

可能出什么问题了?非常感谢您为运行此程序提供的帮助。

reverse-proxy nginx airflow

5
推荐指数
1
解决办法
7028
查看次数

如何将参数传递给 Airflow on_success_callback 和 on_failure_callback

我已经使用 on_success_callback 和 on_failure_callback 实现了关于成功和失败的电子邮件警报。

根据气流文档

上下文字典作为单个参数传递给此函数。

如何将另一个参数传递给这些回调方法?

这是我的代码

from airflow.utils.email import send_email_smtp

def task_success_alert(context):
    subject = "[Airflow] DAG {0} - Task {1}: Success".format(
        context['task_instance_key_str'].split('__')[0], 
        context['task_instance_key_str'].split('__')[1]
        )
    html_content = """
    DAG: {0}<br>
    Task: {1}<br>
    Succeeded on: {2}
    """.format(
        context['task_instance_key_str'].split('__')[0], 
        context['task_instance_key_str'].split('__')[1], 
        datetime.now()
        )
    send_email_smtp(dag_vars["dev_mailing_list"], subject, html_content)

def task_failure_alert(context):
    subject = "[Airflow] DAG {0} - Task {1}: Failed".format(
        context['task_instance_key_str'].split('__')[0], 
        context['task_instance_key_str'].split('__')[1]
        )
    html_content = """
    DAG: {0}<br>
    Task: {1}<br>
    Failed on: {2}
    """.format(
        context['task_instance_key_str'].split('__')[0], 
        context['task_instance_key_str'].split('__')[1], 
        datetime.now()
        )
    send_email_smtp(dag_vars["dev_mailing_list"], subject, html_content)

default_args …
Run Code Online (Sandbox Code Playgroud)

python airflow airflow-scheduler

5
推荐指数
2
解决办法
9188
查看次数

yii2.0在运行http://localhost/~name/yii2hello/backend/web/index.php时发出403错误?r = site/say

我是yii的新手.我很难设置yii2.0高级并试图运行简单的hello程序.

我在后端/ Controllers/SiteController.php中添加了以下代码

public function actionSay($message = 'Hello')
{
    return $this->render('say',['message' => $message]);
}
Run Code Online (Sandbox Code Playgroud)

然后,我使用以下代码在backend/views/site /中创建了say.php文件

<?php
    use yii\helpers\Html;
?>
<?= Html::encode($message) ?>
Run Code Online (Sandbox Code Playgroud)

我输入../yii2hello/backend/web/index.php?r=site/say&message=Hello+World浏览器来访问该页面.

我收到了403错误 "you are not allowed to perform this action."

谁能告诉我问题出在哪里?

php yii yii2

2
推荐指数
1
解决办法
1883
查看次数