forked from welliamcao/OpsManage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1d4a6d
commit 3b071f1
Showing
10 changed files
with
52 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
# _#_ coding:utf-8 _*_ | ||
from celery import task | ||
from utils.notice import Notice | ||
|
||
@task | ||
def apsched_notice(jobs, jobLogs): | ||
status = "失败" | ||
|
||
if jobLogs.get("status") == 0:status = "成功" | ||
|
||
message = """<strong>节点:</strong> {job_node}<br> | ||
<strong>命令:</strong> {job_cmd}<br> | ||
<strong>执行结果:</strong> {result}<br> | ||
<strong>执行状态:</strong> {status}""".format(job_node=jobs.get("job_node"),job_cmd=jobs.get("job_cmd"), | ||
result=jobLogs.get("result"), status=status) | ||
|
||
if jobs.get("notice_type") == 0: | ||
message = { | ||
"e_content":message, | ||
"e_sub":"[OpsManage-任务通知] {job_name}".format(job_name=jobs.get("job_name")), | ||
"e_to":jobs.get("notice_number") | ||
} | ||
|
||
Notice(jobs.get("notice_type")).send(**message) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters