{"id":441641,"date":"2021-04-15T10:39:08","date_gmt":"2021-04-15T02:39:08","guid":{"rendered":"http:\/\/4563.org\/?p=441641"},"modified":"2021-04-15T10:39:08","modified_gmt":"2021-04-15T02:39:08","slug":"python-schedule-task","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=441641","title":{"rendered":"Python schedule task"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python schedule task               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : badacook <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u5728\u6267\u884c\u65e5\u5e38\u7ba1\u7406\u4efb\u52a1\u65f6\uff0c\u6709\u65f6\u60f3\u5b9e\u73b0\u4e00\u4e2a\u4efb\u52a1\u811a\u672c\uff0c\u53ea\u6b63\u786e\u8fd0\u884c\u4e00\u6b21\uff0c\u5c31\u7ec8\u6b62\uff0c<br \/>\u5426\u5219\u5c31\u5faa\u73af\u6267\u884c\u4e00\u5b9a\u6b21\u6570\uff0c\u6216\u8005\u9694\u4e00\u5b9a\u65f6\u95f4\u95f4\u9694\u91cd\u542f\u4efb\u52a1\uff0c\u76f4\u5230\u88ab\u6b63\u786e\u6267\u884c\u4e00\u6b21<\/p>\n<p>\u5982\u5728 windows \u4e0b\uff0c\u8bbe\u5b9a\u4e00\u4e2a\u4efb\u52a1\u8ba1\u5212\uff0c\u5c31\u50cf\u5e94 do {} until () \u5faa\u73af\u4e00\u6837\uff0c<br \/>do \u8868\u8fbe\u5f0f \u662f\u6267\u884c python \u811a\u672c\u7684\u8bed\u53e5\uff0cuntil \u7684\u7ec8\u6b62\u6761\u4ef6\u662f python \u811a\u672c\u7684 exit code \u4e3a 0<br \/>\u4e0d\u77e5\u9053\u8fd9\u79cd\u8c03\u7528\u80fd\u5426\u5b9e\u73b0\uff0c\u8fd8\u671b\u5927\u5bb6\u6307\u70b9\u4e00\u4e0b \u6216\u8005\u6709\u7c7b\u4f3c\u7684\u89e3\u51b3\u65b9\u5f0f\uff0c\u8c22\u8c22\u4e86      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5756161\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tisswb <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             windows \u6709\u8ba1\u5212\u4efb\u52a1\u8fd9\u4e2a\u53ef\u4ee5\u5b9e\u73b0\uff0c\u4e0d\u8fc7\u6709\u65f6\u5019\u5f97\u914d\u5408\u4e00\u4e0b\u811a\u672c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5756162\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : junnplus <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u662f\u7b80\u5355\u7684\u573a\u666f\uff0c\u52a0\u4e00\u4e2a retry \u88c5\u9970\u5668\u5c31\u53ef\u4ee5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5756163\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : j0hnj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/github.com\/jd\/tenacity<br \/>https:\/\/github.com\/litl\/backoff                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5756164\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : est <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u90fd\u8fd9\u6837\u95ee\u4e86\uff0c\u90a3\u4e48\u4fdd\u9669\u8d77\u89c1\uff0c\u5efa\u8bae bash \u5b9e\u73b0\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5756165\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : clino <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/gist.github.com\/zhangchunlin\/8ba84924e80ef2acdb8ee4ef5e67faff <button onclick=\"lazyGist(this)\">\u00a0\u663e\u793a Gist \u4ee3\u7801\u00a0<\/button> <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5756166\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : badacook <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @clino \u770b\u4e86\u4e00\u4e0b \u4f60\u7684\u89e3\u51b3\u65b9\u6cd5\u597d\u50cf\u6bd4\u8f83\u63a5\u8fd1\uff0c\u601d\u8def\u5927\u6982\u5c31\u662f\u5728\u4e3b\u7ebf\u7a0b\u91cc\u6355\u83b7\u6267\u884c\u811a\u672c\u7684\u7ebf\u7a0b\u53e5\u67c4 handle\uff0c\u4f20\u5165\u7c7b\u4f3c GetExitCodeThread()\u51fd\u6570\uff0c\u6709\u70b9\u513f\u56de\u8c03\u7684\u610f\u601d\uff0c\u4e0d\u77e5\u9053\u8fd9\u79cd\u7406\u89e3\u5bf9\u4e0d\u5bf9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5756167\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : HelloViper <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             from tenacity import retry, stop_after_attempt                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5756168\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : clino <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @badacook \u6ca1\u6709\u8fd9\u4e48\u590d\u6742\uff0cos.system() \u5c31\u4f1a\u7b49\u5b50\u8fdb\u7a0b\u7ed3\u675f\u624d\u4f1a\u8fd4\u56de\u7684\u3002<br \/>\u542c\u4f60\u8fd9\u4e48\u8bf4\u597d\u50cf\u548c\u4f60\u7684\u9700\u6c42\u4e0d\u4e00\u81f4\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python schedule t&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/441641"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=441641"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/441641\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=441641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=441641"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=441641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}