From 1e51a5161f8e90b8cb3efee689567cf431b598a8 Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 17 Jan 2021 10:00:28 +0800 Subject: [PATCH 01/11] feat: support auto login powerjob-console by url params --- powerjob-server/src/main/resources/static/js/7.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerjob-server/src/main/resources/static/js/7.js b/powerjob-server/src/main/resources/static/js/7.js index 1e490d42..3fa247e7 100644 --- a/powerjob-server/src/main/resources/static/js/7.js +++ b/powerjob-server/src/main/resources/static/js/7.js @@ -8,7 +8,7 @@ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_for_each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.for-each */ \"./node_modules/core-js/modules/es.array.for-each.js\");\n/* harmony import */ var core_js_modules_es_array_for_each__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_for_each__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n/* harmony import */ var core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_1__);\n\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"Welcome\",\n data: function data() {\n return {\n // 应用注册表单是否可见\n appRegisterFormVisible: false,\n // 用户注册表单是否可见\n userRegisterFormVisible: false,\n // 应用注册表单对象\n appRegisterForm: {\n appName: \"\",\n password: undefined\n },\n // 用户注册表单对象\n userRegisterForm: {\n username: \"\",\n phone: \"\",\n email: \"\",\n webHook: \"\"\n },\n // 控制台登陆对象\n appLoginForm: {\n appName: undefined,\n password: undefined\n },\n // 是否保持登录状态\n stayLogged: true\n };\n },\n methods: {\n // 请求应用下拉框数据\n queryAppNames: function queryAppNames(queryString, cb) {\n var array = [];\n var that = this;\n var url = \"/appInfo/list?condition=\" + queryString;\n this.axios.get(url).then(function (result) {\n result.forEach(function (appInfo) {\n array.push({\n \"value\": appInfo.appName\n });\n cb(array);\n });\n }, function (error) {\n return that.$message.error(error);\n });\n clearTimeout(this.timeout);\n this.timeout = setTimeout(function () {\n cb(array);\n }, 3000);\n },\n // 注册应用\n registerApp: function registerApp() {\n var _this = this;\n\n var that = this;\n this.axios.post(\"/appInfo/save\", this.appRegisterForm).then(function () {\n that.$message.success(_this.$t('message.success'));\n that.appRegisterFormVisible = false;\n }, that.appRegisterFormVisible = false);\n },\n // 注册用户(仅用于报警通知)\n registerUser: function registerUser() {\n var _this2 = this;\n\n var that = this;\n this.axios.post(\"/user/save\", this.userRegisterForm).then(function () {\n that.$message.success(_this2.$t('message.success'));\n that.userRegisterFormVisible = false;\n }, that.userRegisterFormVisible = false);\n },\n // 登陆控制台\n login: function login() {\n var _this3 = this;\n\n var that = this;\n this.axios.post(\"/appInfo/assert\", this.appLoginForm).then(function (res) {\n // 勾选了保持登录状态,就开启自动登录,直接本地存用户名密码(内部系统浏览器明文存问题不大)\n if (_this3.stayLogged) {\n window.localStorage.setItem('oms_auto_login', JSON.stringify(_this3.appLoginForm));\n }\n\n var appInfo = {\n id: res,\n appName: that.appLoginForm.appName\n }; // 将 appId 存储到 VueStore\n\n _this3.$store.commit(\"initAppInfo\", appInfo); // 跳转到主界面\n\n\n _this3.$router.push(\"/oms/home\");\n }, function (error) {\n window.localStorage.removeItem('oms_auto_login');\n that.$message.error(error);\n });\n },\n // 自动登录\n autoLogin: function autoLogin() {\n var autoLoginString = window.localStorage.getItem(\"oms_auto_login\");\n\n if (autoLoginString === undefined || autoLoginString === null) {\n return;\n }\n\n this.appLoginForm = JSON.parse(autoLoginString);\n this.login();\n }\n },\n mounted: function mounted() {\n // 加载默认语言配置文件\n var localLang = window.localStorage.getItem('oms_lang');\n console.log(\"language from localStorage is %o\", localLang);\n\n if (localLang != null) {\n this.$i18n.locale = localLang;\n } else {\n var lang = navigator.language;\n console.log(\"language from system is %o\", lang);\n\n switch (lang) {\n case \"zh-HK\":\n case \"zh-TW\":\n case \"zh-SG\":\n case \"zh-CN\":\n this.$i18n.locale = \"cn\";\n break;\n\n default:\n this.$i18n.locale = \"en\";\n }\n } // 自动登录\n\n\n this.autoLogin();\n }\n});\n\n//# sourceURL=webpack:///./src/components/Welcome.vue?./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_for_each__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.for-each */ \"./node_modules/core-js/modules/es.array.for-each.js\");\n/* harmony import */ var core_js_modules_es_array_for_each__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_for_each__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n/* harmony import */ var core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each__WEBPACK_IMPORTED_MODULE_1__);\n\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"Welcome\",\n data: function data() {\n return {\n // 应用注册表单是否可见\n appRegisterFormVisible: false,\n // 用户注册表单是否可见\n userRegisterFormVisible: false,\n // 应用注册表单对象\n appRegisterForm: {\n appName: \"\",\n password: undefined\n },\n // 用户注册表单对象\n userRegisterForm: {\n username: \"\",\n phone: \"\",\n email: \"\",\n webHook: \"\"\n },\n // 控制台登陆对象\n appLoginForm: {\n appName: undefined,\n password: undefined\n },\n // 是否保持登录状态\n stayLogged: true\n };\n },\n methods: {\n // 请求应用下拉框数据\n queryAppNames: function queryAppNames(queryString, cb) {\n var array = [];\n var that = this;\n var url = \"/appInfo/list?condition=\" + queryString;\n this.axios.get(url).then(function (result) {\n result.forEach(function (appInfo) {\n array.push({\n \"value\": appInfo.appName\n });\n cb(array);\n });\n }, function (error) {\n return that.$message.error(error);\n });\n clearTimeout(this.timeout);\n this.timeout = setTimeout(function () {\n cb(array);\n }, 3000);\n },\n // 注册应用\n registerApp: function registerApp() {\n var _this = this;\n\n var that = this;\n this.axios.post(\"/appInfo/save\", this.appRegisterForm).then(function () {\n that.$message.success(_this.$t('message.success'));\n that.appRegisterFormVisible = false;\n }, that.appRegisterFormVisible = false);\n },\n // 注册用户(仅用于报警通知)\n registerUser: function registerUser() {\n var _this2 = this;\n\n var that = this;\n this.axios.post(\"/user/save\", this.userRegisterForm).then(function () {\n that.$message.success(_this2.$t('message.success'));\n that.userRegisterFormVisible = false;\n }, that.userRegisterFormVisible = false);\n },\n // 登陆控制台\n login: function login() {\n var _this3 = this;\n\n var that = this;\n this.axios.post(\"/appInfo/assert\", this.appLoginForm).then(function (res) {\n // 勾选了保持登录状态,就开启自动登录,直接本地存用户名密码(内部系统浏览器明文存问题不大)\n if (_this3.stayLogged) {\n window.localStorage.setItem('oms_auto_login', JSON.stringify(_this3.appLoginForm));\n }\n\n var appInfo = {\n id: res,\n appName: that.appLoginForm.appName\n }; // 将 appId 存储到 VueStore\n\n _this3.$store.commit(\"initAppInfo\", appInfo); // 跳转到主界面\n\n\n _this3.$router.push(\"/oms/home\");\n }, function (error) {\n window.localStorage.removeItem('oms_auto_login');\n that.$message.error(error);\n });\n },\n // 自动登录\n autoLogin: function autoLogin() {\n var autoLoginString = window.localStorage.getItem(\"oms_auto_login\");\n\n if (autoLoginString === undefined || autoLoginString === null) {\n return;\n }\n\n this.appLoginForm = JSON.parse(autoLoginString);\n this.login();\n },\n // 通过 URL 自动登陆\n loginByUrlParams: function loginByUrlParams() {\n var appName = this.$route.query.appName;\n var password = this.$route.query.password;\n console.log(\"login params from url: %o, %o\", appName, password);\n\n if (appName === undefined || appName === null || appName === '') {\n return;\n }\n\n this.appLoginForm.appName = appName;\n this.appLoginForm.password = password;\n this.login();\n }\n },\n mounted: function mounted() {\n // 加载默认语言配置文件\n var localLang = window.localStorage.getItem('oms_lang');\n console.log(\"language from localStorage is %o\", localLang);\n\n if (localLang != null) {\n this.$i18n.locale = localLang;\n } else {\n var lang = navigator.language;\n console.log(\"language from system is %o\", lang);\n\n switch (lang) {\n case \"zh-HK\":\n case \"zh-TW\":\n case \"zh-SG\":\n case \"zh-CN\":\n this.$i18n.locale = \"cn\";\n break;\n\n default:\n this.$i18n.locale = \"en\";\n }\n } // 根据 URL 自动登陆\n\n\n this.loginByUrlParams(); // 根据历史记录自动登陆\n\n this.autoLogin();\n }\n});\n\n//# sourceURL=webpack:///./src/components/Welcome.vue?./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options"); /***/ }), From 4951ccad094d7c39a7ad1a94f3ffeee013d9bb8e Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 17 Jan 2021 10:41:30 +0800 Subject: [PATCH 02/11] docs: update readme --- README.md | 18 ++++++++---------- README_zhCN.md | 15 +++++---------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 44e9739d..7d1b73a0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -English | [简体中文](./README_zhCN.md) +### English | [简体中文](./README_zhCN.md)

PowerJob @@ -13,20 +13,20 @@ English | [简体中文](./README_zhCN.md) [PowerJob](https://github.com/PowerJob/PowerJob) is an open-source distributed computing and job scheduling framework which allows developers to easily schedule tasks in their own application. -Refer to [Quick Started Tutorial](https://www.yuque.com/powerjob/en/baz8y6) for detailed information. +Refer to [Quick Started Tutorial](https://www.yuque.com/powerjob/en/quickstart) for detailed information. # Introduction ### Features -- **Friendly UI:** [Front-end](http://try.powerjob.tech/#/welcome) page is provided and developers can manage their task, monitor the status, check the logs online, etc. +- **Friendly UI:** [Front-end](http://try.powerjob.tech/#/welcome?appName=powerjob-agent-test&password=123) page is provided and developers can manage their task, monitor the status, check the logs online, etc. - **Abundant Timing Strategies:** Four timing strategies are supported, including CRON expression, fixed rate, fixed delay and OpenAPI. -- **Multiple Execution Mode:** Four execution modes are supported, including stand-alone, broadcast, Map and MapReduce. Distributed computing resource could be utilized in MapReduce mode, try the magic out [here](http://try.powerjob.tech/)! +- **Multiple Execution Mode:** Four execution modes are supported, including stand-alone, broadcast, Map and MapReduce. Distributed computing resource could be utilized in MapReduce mode, try the magic out [here](https://www.yuque.com/powerjob/en/za1d96#9YOnV)! - **DAG Job Flow Support:** Both job dependency management and data communications between jobs are supported. -- **Cross-language Client Support:** So far, developers can use Java, Spring, Shell, Python to write their own PowerJob client and define tasks that can be triggered by PowerJob workflow. +- **Extensive Processor Support:** Developers can write their processors in Java, Shell, Python, and will subsequently support multilingual scheduling via HTTP. - **Disaster Tolerance Support:** As long as there are enough computing nodes, configurable retry policies make it possible for your task to be executed and finished successfully. @@ -36,13 +36,11 @@ Refer to [Quick Started Tutorial](https://www.yuque.com/powerjob/en/baz8y6) for - Broadcast tasks, for example, broadcasting to the cluster to clear logs. - MapReduce tasks, for example, speeding up certain job like updating large amounts of data. - Delayed tasks, for example, processing overdue orders. -- Customized tasks, triggered with [OpenAPI](https://www.yuque.com/powerjob/en/fs3vg0). +- Customized tasks, triggered with [OpenAPI](https://www.yuque.com/powerjob/en/openapi). ### Online trial - -- Trial address: [Online Trial Address](http://try.powerjob.tech/) -- Application name: powerjob-agent-test -- Application password: 123 +- Address: [try.powerjob.tech](http://try.powerjob.tech/#/welcome?appName=powerjob-agent-test&password=123) +- Recommended to read the documentation first: [here](https://www.yuque.com/powerjob/en/trial) # Documents **[Docs](https://www.yuque.com/powerjob/en/introduce)** diff --git a/README_zhCN.md b/README_zhCN.md index ed6fa4e9..c461f266 100644 --- a/README_zhCN.md +++ b/README_zhCN.md @@ -1,4 +1,4 @@ -[English](./README.md) | 简体中文 +### [English](./README.md) | 简体中文

PowerJob @@ -34,11 +34,8 @@ PowerJob(原OhMyScheduler)是全新一代分布式调度与计算框架, PowerJob 的设计目标为企业级的分布式任务调度平台,即成为公司内部的**任务调度中间件**。整个公司统一部署调度中心 powerjob-server,旗下所有业务线应用只需要依赖 `powerjob-worker` 即可接入调度中心获取任务调度与分布式计算能力。 ### 在线试用 -试用地址:[try.powerjob.tech](http://try.powerjob.tech/) -试用应用名称:powerjob-agent-test -控制台密码:123 - -[建议点击查看试用文档了解相关操作](https://www.yuque.com/powerjob/guidence/hnbskn) +* 试用地址:[try.powerjob.tech](http://try.powerjob.tech/#/welcome?appName=powerjob-agent-test&password=123) +* [建议先阅读使用教程了解 PowerJob 的概念和基本用法](https://www.yuque.com/powerjob/guidence/trial) ### 同类产品对比 | | QuartZ | xxl-job | SchedulerX 2.0 | PowerJob | @@ -55,11 +52,9 @@ PowerJob 的设计目标为企业级的分布式任务调度平台,即成为 # 官方文档 -**[中文文档](https://www.yuque.com/powerjob/guidence/ztn4i5)** +**[中文文档](https://www.yuque.com/powerjob/guidence/intro)** -**[Document](https://www.yuque.com/powerjob/en/xrdoqw)** - -PS:感谢文档翻译平台[breword](https://www.breword.com/)对本项目英文文档翻译做出的巨大贡献! +**[Docs](https://www.yuque.com/powerjob/en/introduce)** # 接入登记 [点击进行接入登记,为 PowerJob 的发展贡献自己的力量!](https://github.com/PowerJob/PowerJob/issues/6) From b71d167afd9a7ea7540069e2b6b8cad96203ac12 Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 17 Jan 2021 11:02:39 +0800 Subject: [PATCH 03/11] docs: update readme --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7d1b73a0..0ccf1b81 100644 --- a/README.md +++ b/README.md @@ -13,22 +13,24 @@ [PowerJob](https://github.com/PowerJob/PowerJob) is an open-source distributed computing and job scheduling framework which allows developers to easily schedule tasks in their own application. -Refer to [Quick Started Tutorial](https://www.yuque.com/powerjob/en/quickstart) for detailed information. +Refer to [PowerJob Introduction](https://www.yuque.com/powerjob/en/introduce) for detailed information. # Introduction ### Features - **Friendly UI:** [Front-end](http://try.powerjob.tech/#/welcome?appName=powerjob-agent-test&password=123) page is provided and developers can manage their task, monitor the status, check the logs online, etc. -- **Abundant Timing Strategies:** Four timing strategies are supported, including CRON expression, fixed rate, fixed delay and OpenAPI. +- **Abundant Timing Strategies:** Four timing strategies are supported, including CRON expression, fixed rate, fixed delay and OpenAPI which allows you to define your own scheduling policies, such as delaying execution. - **Multiple Execution Mode:** Four execution modes are supported, including stand-alone, broadcast, Map and MapReduce. Distributed computing resource could be utilized in MapReduce mode, try the magic out [here](https://www.yuque.com/powerjob/en/za1d96#9YOnV)! -- **DAG Job Flow Support:** Both job dependency management and data communications between jobs are supported. +- **Workflow(DAG) Support:** Both job dependency management and data communications between jobs are supported. - **Extensive Processor Support:** Developers can write their processors in Java, Shell, Python, and will subsequently support multilingual scheduling via HTTP. -- **Disaster Tolerance Support:** As long as there are enough computing nodes, configurable retry policies make it possible for your task to be executed and finished successfully. +- **Powerful Disaster Tolerance:** As long as there are enough computing nodes, configurable retry policies make it possible for your task to be executed and finished successfully. + +- **High Availability & High Performance:** PowerJob supports unlimited horizontal expansion. It's easy to achieve high availability and performance by deploying as many PowerJob server and worker nodes. ### Applicable scenes @@ -45,7 +47,7 @@ Refer to [Quick Started Tutorial](https://www.yuque.com/powerjob/en/quickstart) # Documents **[Docs](https://www.yuque.com/powerjob/en/introduce)** -**[中文文档](https://www.yuque.com/powerjob/guidence/ztn4i5)** +**[中文文档](https://www.yuque.com/powerjob/guidence/intro)** # Known Users [Click to register as PowerJob user!](https://github.com/PowerJob/PowerJob/issues/6) From 5dbc8db849ec13558ea0d457dc337644563f0b2b Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 17 Jan 2021 17:19:07 +0800 Subject: [PATCH 04/11] style: optimize .ignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 15e8d172..47d2017f 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,4 @@ build/ *.jar *.log */.DS_Store -.DS_Store +.DS_Store \ No newline at end of file From 9e349a202ac213037e0d1792ae3be37d73e31482 Mon Sep 17 00:00:00 2001 From: tjq Date: Tue, 19 Jan 2021 09:15:37 +0800 Subject: [PATCH 05/11] feat: support using network interface name for NetUtils #179 --- .../com/github/kfcfans/powerjob/common/utils/NetUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java index 68a41df0..542393ab 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java @@ -297,7 +297,11 @@ public class NetUtils { */ public static boolean isPreferredNetworkInterface(NetworkInterface networkInterface) { String preferredNetworkInterface = System.getProperty(PowerJobDKey.PREFERRED_NETWORK_INTERFACE); - return Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface); + if (Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface)) { + return true; + } + // 兼容直接使用网卡名称的情况,比如 Realtek PCIe GBE Family Controller + return Objects.equals(networkInterface.getName(), preferredNetworkInterface); } static boolean ignoreInterfaceByConfig(String interfaceName) { From 2035bd654476a17ad0b476b66d1a7fdf1626c7bb Mon Sep 17 00:00:00 2001 From: tjq Date: Tue, 19 Jan 2021 09:19:43 +0800 Subject: [PATCH 06/11] feat: support using network interface name for NetUtils #179 --- .../java/com/github/kfcfans/powerjob/common/utils/NetUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java index 542393ab..8b0c5105 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/NetUtils.java @@ -246,7 +246,7 @@ public class NetUtils { continue; } // 根据用户 -D 参数忽略网卡 - if (ignoreInterfaceByConfig(networkInterface.getDisplayName())) { + if (ignoreInterfaceByConfig(networkInterface.getDisplayName()) || ignoreInterfaceByConfig(networkInterface.getName())) { continue; } validNetworkInterfaces.add(networkInterface); From fb29d8013b7ae5943b5521819b746ee01172b561 Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 31 Jan 2021 13:26:38 +0800 Subject: [PATCH 07/11] fix: JobInfoQuery can't serialize #183 --- .../powerjob/client/test/TestQuery.java | 18 +++++++++--------- .../common/request/query/JobInfoQuery.java | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/powerjob-client/src/test/java/com/github/kfcfans/powerjob/client/test/TestQuery.java b/powerjob-client/src/test/java/com/github/kfcfans/powerjob/client/test/TestQuery.java index cf9f2ad3..003043de 100644 --- a/powerjob-client/src/test/java/com/github/kfcfans/powerjob/client/test/TestQuery.java +++ b/powerjob-client/src/test/java/com/github/kfcfans/powerjob/client/test/TestQuery.java @@ -33,17 +33,17 @@ class TestQuery extends ClientInitializer { @Test void testQueryJob() { JobInfoQuery jobInfoQuery = new JobInfoQuery() - .idGt(-1L) - .idLt(10086L) - .jobNameLike("DAG") - .gmtModifiedGt(DateUtils.addYears(new Date(), -10)) - .gmtModifiedLt(DateUtils.addDays(new Date(), 10)) - .executeTypeIn(Lists.newArrayList(ExecuteType.STANDALONE.getV(), ExecuteType.BROADCAST.getV(), ExecuteType.MAP_REDUCE.getV())) - .timeExpressionIn(Lists.newArrayList(TimeExpressionType.API.name(), TimeExpressionType.CRON.name(), TimeExpressionType.WORKFLOW.name(), TimeExpressionType.FIXED_RATE.name())) - .processorTypeIn(Lists.newArrayList(ProcessorType.EMBEDDED_JAVA.getV(), ProcessorType.SHELL.getV(), ProcessorType.JAVA_CONTAINER.getV())) - .processorInfoLike("com.github.kfcfans"); + .setIdGt(-1L) + .setIdLt(10086L) + .setJobNameLike("DAG") + .setGmtModifiedGt(DateUtils.addYears(new Date(), -10)) + .setGmtCreateLt(DateUtils.addDays(new Date(), 10)) + .setExecuteTypeIn(Lists.newArrayList(ExecuteType.STANDALONE.getV(), ExecuteType.BROADCAST.getV(), ExecuteType.MAP_REDUCE.getV())) + .setProcessorTypeIn(Lists.newArrayList(ProcessorType.EMBEDDED_JAVA.getV(), ProcessorType.SHELL.getV(), ProcessorType.JAVA_CONTAINER.getV())) + .setProcessorInfoLike("com.github.kfcfans"); ResultDTO> jobQueryResult = ohMyClient.queryJob(jobInfoQuery); System.out.println(JSON.toJSONString(jobQueryResult)); + System.out.println(jobQueryResult.getData().size()); } } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/query/JobInfoQuery.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/query/JobInfoQuery.java index f1b2bf9d..754fbd71 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/query/JobInfoQuery.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/query/JobInfoQuery.java @@ -16,7 +16,7 @@ import java.util.List; */ @Getter @Setter -@Accessors(chain = true, fluent = true) +@Accessors(chain = true) public class JobInfoQuery extends PowerQuery { private Long idEq; @@ -31,7 +31,6 @@ public class JobInfoQuery extends PowerQuery { private String jobParamsLike; private List timeExpressionTypeIn; - private List timeExpressionIn; private List executeTypeIn; private List processorTypeIn; From cdaea08ba7d5a7acf8487df54ffb2f801512b1d7 Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 31 Jan 2021 14:20:52 +0800 Subject: [PATCH 08/11] fix: the bug of tasks occasionally cannot be stopped #180 --- .../powerjob/server/service/instance/InstanceManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/service/instance/InstanceManager.java b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/service/instance/InstanceManager.java index 338d540a..da6f6403 100644 --- a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/service/instance/InstanceManager.java +++ b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/service/instance/InstanceManager.java @@ -73,6 +73,12 @@ public class InstanceManager { return; } + // 如果任务已经结束,直接丢弃该请求(StopInstance 和 ReportStatus 同时发送的情况) + if (InstanceStatus.finishedStatus.contains(instanceInfo.getStatus())) { + log.info("[InstanceManager-{}] instance already finished, this report[{}] will be dropped!", instanceId, req); + return; + } + InstanceStatus newStatus = InstanceStatus.of(req.getInstanceStatus()); Integer timeExpressionType = jobInfo.getTimeExpressionType(); From cce26511d8bf260923d33f3eb019620656a761ca Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 31 Jan 2021 14:44:51 +0800 Subject: [PATCH 09/11] fix: task status rollback #190 --- .../github/kfcfans/powerjob/common/utils/CommonUtils.java | 6 ++++++ .../powerjob/worker/core/executor/ProcessorRunnable.java | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/CommonUtils.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/CommonUtils.java index 78c1973a..17a5dbba 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/CommonUtils.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/utils/CommonUtils.java @@ -155,4 +155,10 @@ public class CommonUtils { return StringUtils.replace(UUID.randomUUID().toString(), "-", ""); } + public static void easySleep(long millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException ignore) { + } + } } diff --git a/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/executor/ProcessorRunnable.java b/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/executor/ProcessorRunnable.java index 8a3798cd..ef0e61ad 100644 --- a/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/executor/ProcessorRunnable.java +++ b/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/executor/ProcessorRunnable.java @@ -2,6 +2,7 @@ package com.github.kfcfans.powerjob.worker.core.executor; import akka.actor.ActorSelection; import com.github.kfcfans.powerjob.common.ExecuteType; +import com.github.kfcfans.powerjob.common.utils.CommonUtils; import com.github.kfcfans.powerjob.worker.OhMyWorker; import com.github.kfcfans.powerjob.worker.common.ThreadLocalStore; import com.github.kfcfans.powerjob.worker.common.constants.TaskConstant; @@ -161,6 +162,9 @@ public class ProcessorRunnable implements Runnable { * @param cmd 特殊需求,比如广播执行需要创建广播任务 */ private void reportStatus(TaskStatus status, String result, Integer cmd) { + + CommonUtils.easySleep(1); + ProcessorReportTaskStatusReq req = new ProcessorReportTaskStatusReq(); req.setInstanceId(task.getInstanceId()); From 2066f5d1daad8120f0de6ec2d1830a644e0fbee0 Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 31 Jan 2021 15:20:56 +0800 Subject: [PATCH 10/11] refactor: optimize powerjob-agent's logback config --- .../src/main/resources/logback.xml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/powerjob-worker-agent/src/main/resources/logback.xml b/powerjob-worker-agent/src/main/resources/logback.xml index ac501a9a..757c6364 100644 --- a/powerjob-worker-agent/src/main/resources/logback.xml +++ b/powerjob-worker-agent/src/main/resources/logback.xml @@ -9,7 +9,7 @@ + value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) |%highlight(%-5level) |%blue(%thread) |%green(%logger{10}) |%cyan(%msg%n)"/> @@ -32,7 +32,7 @@ 3 - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{10} - %msg%n UTF-8 @@ -41,6 +41,9 @@ DENY + + + @@ -52,16 +55,17 @@ 3 - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{10} - %msg%n UTF-8 true + + + - - From b642e1b39b3326352f8e7b1d7bf52f11e44abf37 Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 31 Jan 2021 17:39:58 +0800 Subject: [PATCH 11/11] feat: change version to v3.4.5 --- powerjob-client/pom.xml | 4 ++-- powerjob-common/pom.xml | 2 +- powerjob-server/pom.xml | 4 ++-- powerjob-worker-agent/pom.xml | 4 ++-- powerjob-worker-samples/pom.xml | 4 ++-- powerjob-worker-spring-boot-starter/pom.xml | 4 ++-- powerjob-worker/pom.xml | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/powerjob-client/pom.xml b/powerjob-client/pom.xml index 4cd4c85d..a0b3ee4c 100644 --- a/powerjob-client/pom.xml +++ b/powerjob-client/pom.xml @@ -10,13 +10,13 @@ 4.0.0 powerjob-client - 3.4.4 + 3.4.5 jar 5.6.1 1.2.68 - 3.4.4 + 3.4.5 3.2.4 diff --git a/powerjob-common/pom.xml b/powerjob-common/pom.xml index 3f5fa205..5e9b64fa 100644 --- a/powerjob-common/pom.xml +++ b/powerjob-common/pom.xml @@ -10,7 +10,7 @@ 4.0.0 powerjob-common - 3.4.4 + 3.4.5 jar diff --git a/powerjob-server/pom.xml b/powerjob-server/pom.xml index b637e898..3f03c668 100644 --- a/powerjob-server/pom.xml +++ b/powerjob-server/pom.xml @@ -10,13 +10,13 @@ 4.0.0 powerjob-server - 3.4.4 + 3.4.5 jar 2.9.2 2.3.4.RELEASE - 3.4.4 + 3.4.5 8.0.19 19.7.0.0 diff --git a/powerjob-worker-agent/pom.xml b/powerjob-worker-agent/pom.xml index b108e4c3..1f0387b6 100644 --- a/powerjob-worker-agent/pom.xml +++ b/powerjob-worker-agent/pom.xml @@ -10,12 +10,12 @@ 4.0.0 powerjob-worker-agent - 3.4.4 + 3.4.5 jar - 3.4.4 + 3.4.5 1.2.3 4.3.2 diff --git a/powerjob-worker-samples/pom.xml b/powerjob-worker-samples/pom.xml index ee816b24..62ff1e68 100644 --- a/powerjob-worker-samples/pom.xml +++ b/powerjob-worker-samples/pom.xml @@ -10,11 +10,11 @@ 4.0.0 powerjob-worker-samples - 3.4.4 + 3.4.5 2.2.6.RELEASE - 3.4.4 + 3.4.5 1.2.68 diff --git a/powerjob-worker-spring-boot-starter/pom.xml b/powerjob-worker-spring-boot-starter/pom.xml index 1e0d7a92..763c5575 100644 --- a/powerjob-worker-spring-boot-starter/pom.xml +++ b/powerjob-worker-spring-boot-starter/pom.xml @@ -10,11 +10,11 @@ 4.0.0 powerjob-worker-spring-boot-starter - 3.4.4 + 3.4.5 jar - 3.4.4 + 3.4.5 2.2.6.RELEASE diff --git a/powerjob-worker/pom.xml b/powerjob-worker/pom.xml index 536f28db..a0e424cf 100644 --- a/powerjob-worker/pom.xml +++ b/powerjob-worker/pom.xml @@ -10,12 +10,12 @@ 4.0.0 powerjob-worker - 3.4.4 + 3.4.5 jar 5.2.4.RELEASE - 3.4.4 + 3.4.5 1.4.200 3.4.2 5.6.1