text: (window.webpackJsonp=window.webpackJsonp||[]).push([[43],{298:function(e,t,a){"use strict";a.d(t,"a",(function(){return b})),a.d(t,"b",(function(){return h}));var n=a(0),r=a.n(n);function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){o(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=r.a.createContext({}),d=function(e){var t=r.a.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):c(c({},t),e)),a},b=function(e){var t=d(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},p=r.a.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,i=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),b=d(a),p=n,h=b["".concat(i,".").concat(p)]||b[p]||u[p]||o;return a?r.a.createElement(h,c(c({ref:t},s),{},{components:a})):r.a.createElement(h,c({ref:t},s))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,i=new Array(o);i[0]=p;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:n,i[1]=c;for(var s=2;s<o;s++)i[s]=a[s];return r.a.createElement.apply(null,i)}return r.a.createElement.apply(null,a)}p.displayName="MDXCreateElement"},96:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return i})),a.d(t,"metadata",(function(){return c})),a.d(t,"rightToc",(function(){return l})),a.d(t,"default",(function(){return d}));var n=a(2),r=a(6),o=(a(0),a(298)),i={title:"Module h2o_wave.autoreload"},c={unversionedId:"api/autoreload",id:"api/autoreload",isDocsHomePage:!1,title:"Module h2o_wave.autoreload",description:"Functions",source:"@site/docs/api/autoreload.md",slug:"/api/autoreload",permalink:"/wave/docs/api/autoreload",editUrl:"https://github.com/h2oai/wave/edit/master/website/docs/api/autoreload.md",version:"current"},l=[{value:"Functions",id:"functions",children:[{value:'add_reload_hook <a name="h2o_wave.autoreload.add_reload_hook"/>',id:"add_reload_hook",children:[]},{value:'main <a name="h2o_wave.autoreload.main"/>',id:"main",children:[]},{value:'rerun <a name="h2o_wave.autoreload.rerun"/>',id:"rerun",children:[]},{value:'start <a name="h2o_wave.autoreload.start"/>',id:"start",children:[]},{value:'wait <a name="h2o_wave.autoreload.wait"/>',id:"wait",children:[]},{value:'watch <a name="h2o_wave.autoreload.watch"/>',id:"watch",children:[]}]}],s={rightToc:l};function d(e){var t=e.components,a=Object(r.a)(e,["components"]);return Object(o.b)("wrapper",Object(n.a)({},s,a,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"functions"},"Functions"),Object(o.b)("div",{className:"api"},Object(o.b)("h3",{id:"add_reload_hook"},"add_reload_hook ",Object(o.b)("a",{name:"h2o_wave.autoreload.add_reload_hook"})),Object(o.b)("div",{className:"api__body"},Object(o.b)("div",{className:"api__signature"},"def ",Object(o.b)("span",{class:"ident"},"add_reload_hook"),"(fn:\xa0Callable[[],\xa0NoneType]) \u2011>\xa0NoneType"),Object(o.b)("div",{className:"api__description"},Object(o.b)("p",null,"Add a function to be called before reloading the process."),Object(o.b)("p",null,"Note that for open file and socket handles it is generally preferable to set the ",Object(o.b)("code",null,"FD_CLOEXEC")," flag (using ",Object(o.b)("code",null,"fcntl")," or",Object(o.b)("code",null,"os.set_inheritable"),") instead of using a reload hook to close them.")))),Object(o.b)("div",{className:"api"},Object(o.b)("h3",{id:"main"},"main ",Object(o.b)("a",{name:"h2o_wave.autoreload.main"})),Object(o.b)("div",{className:"api__body"},Object(o.b)("div",{className:"api__signature"},"def ",Object(o.b)("span",{class:"ident"},"main"),"() \u2011>\xa0NoneType"),Object(o.b)("div",{className:"api__description"},Object(o.b)("p",null,"Command-line wrapper to re-run a script whenever its source changes."),Object(o.b)("p",null,"Scripts may be specified by filename or module name::"),Object(o.b)("pre",null,Object(o.b)("code",null,"python -m h2o_wave -m h2o_wave.test.runtests python -m h2o_wave h2o_wave/test/runtests.py")),Object(o.b)("p",null,"Running a script with this wrapper is similar to calling",Object(o.b)("code",null,Object(o.b)("a",{title:"h2o_wave.autoreload.wait",href:"#h2o_wave.autoreload.wait"},"wait()"))," at the end of the script, but this wrapper can catch import-time problems like syntax errors that would otherwise prevent the script from reaching its call to ",Object(o.b)("code",null,Object(o.b)("a",{title:"h2o_wave.autoreload.wait",href:"#h2o_wave.autoreload.wait"},"wait()")),".")))),Object(o.b)("div",{className:"api"},Object(o.b)("h3",{id:"rerun"},"rerun ",Object(o.b)("a",{name:"h2o_wave.autoreload.rerun"})),Object(o.b)("div",{className:"api__body"},Object(o.b)("div",{className:"api__signature"},"def ",Object(o.b)("span",{class:"ident"},"rerun"),"(code:\xa0Any, glob:\xa0Dict[str,\xa0Any], loc:\xa0Union[Mapping[str,\xa0Any],\xa0NoneType]\xa0=\xa0None) \u2011>\xa0NoneType"),Object(o.b)("div",{className:"api__description"}))),Object(o.b)("div",{className:"api"},Object(o.b)("h3",{id:"start"},"start ",Object(o.b)("a",{name:"h2o_wave.autoreload.start"})),Object(o.b)("div",{className:"api__body"},Object(o.b)("div",{className:"api__signature"},"def ",Object(o.b)("span",{class:"ident"},"start"),"(check_time:\xa0int\xa0=\xa0500) \u2011>\xa0NoneType"),Object(o.b)("div",{className:"api__description"},Object(o.b)("p",null,"Begins watching source files for changes.")))),Object(o.b)("div",{className:"api"},Object(o.b)("h3",{id:"wait"},"wait ",Object(o.b)("a",{name:"h2o_wave.autoreload.wait"})),Object(o.b)("div",{className:"api__body"},Object(o.b)("div",{className:"api__signature"},"def ",Object(o.b)("span",{class:"ident"},"wait"),"() \u2011>\xa0NoneType"),Object(o.b)("div",{className:"api__description"},Object(o.b)("p",null,"Wait for a watched file to change, then restart the process."),Object(o.b)("p",null,"Intended to be used at the end of scripts like unit test runners, to run the tests again after any source file changes (but see also the command-line interface in ",Object(o.b)("code",null,Object(o.b)("a",{title:"h2o_wave.autoreload.main",href:"#h2o_wave.autoreload.main"},"main()")),")")))),Object(o.b)("div",{className:"api"},Object(o.b)("h3",{id:"watch"},"watch ",Object(o.b)("a",{name:"h2o_wave.autoreload.watch"})),Object(o.b)("div",{className:"api__body"},Object(o.b)("div",{className:"api__signature"},"def ",Object(o.b)("span",{class:"ident"},"watch"),"(filename:\xa0str) \u2011>\xa0NoneType"),Object(o.b)("div",{className:"api__description"},Object(o.b)("p",null,"Add a file to the watch list."),Object(o.b)("p",null,"All imported modules are watched by default.")))))}d.isMDXComponent=!0}}]);