howto.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>How to run &#8212; Modelverse 0.4.0 documentation</title>
  7. <link rel="stylesheet" href="_static/classic.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: './',
  12. VERSION: '0.4.0',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="_static/jquery.js"></script>
  19. <script type="text/javascript" src="_static/underscore.js"></script>
  20. <script type="text/javascript" src="_static/doctools.js"></script>
  21. <link rel="top" title="Modelverse 0.4.0 documentation" href="index.html" />
  22. <link rel="next" title="Action Language" href="actionlanguage.html" />
  23. <link rel="prev" title="Modelverse components" href="components.html" />
  24. </head>
  25. <body role="document">
  26. <div class="related" role="navigation" aria-label="related navigation">
  27. <h3>Navigation</h3>
  28. <ul>
  29. <li class="right" style="margin-right: 10px">
  30. <a href="genindex.html" title="General Index"
  31. accesskey="I">index</a></li>
  32. <li class="right" >
  33. <a href="actionlanguage.html" title="Action Language"
  34. accesskey="N">next</a> |</li>
  35. <li class="right" >
  36. <a href="components.html" title="Modelverse components"
  37. accesskey="P">previous</a> |</li>
  38. <li class="nav-item nav-item-0"><a href="index.html">Modelverse 0.4.0 documentation</a> &#187;</li>
  39. </ul>
  40. </div>
  41. <div class="document">
  42. <div class="documentwrapper">
  43. <div class="bodywrapper">
  44. <div class="body" role="main">
  45. <div class="section" id="how-to-run">
  46. <h1>How to run<a class="headerlink" href="#how-to-run" title="Permalink to this headline">¶</a></h1>
  47. <p>Running the Modelverse is all done through the use of scripts to coordinate the three different projects.</p>
  48. <p>The following scripts are included by default.</p>
  49. <div class="section" id="check-objects-py">
  50. <h2>check_objects.py<a class="headerlink" href="#check-objects-py" title="Permalink to this headline">¶</a></h2>
  51. <p>Checks whether all compiled objects can be found, and if their symbol table does not contain undefined references.
  52. This script cannot be executed directly and is only a helper.</p>
  53. </div>
  54. <div class="section" id="compile-py">
  55. <h2>compile.py<a class="headerlink" href="#compile-py" title="Permalink to this headline">¶</a></h2>
  56. <p>Compiles the provided code with the selected mode.
  57. This should also not be called by end-users, though it is possible.</p>
  58. <p>Invocation:</p>
  59. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="nb">compile</span><span class="o">.</span><span class="n">py</span> <span class="n">address</span> <span class="n">file</span> <span class="n">username</span> <span class="nb">object</span> <span class="n">mode</span>
  60. </pre></div>
  61. </div>
  62. <table border="1" class="docutils">
  63. <colgroup>
  64. <col width="19%" />
  65. <col width="52%" />
  66. <col width="29%" />
  67. </colgroup>
  68. <thead valign="bottom">
  69. <tr class="row-odd"><th class="head">Parameter name</th>
  70. <th class="head">Description</th>
  71. <th class="head">Example</th>
  72. </tr>
  73. </thead>
  74. <tbody valign="top">
  75. <tr class="row-even"><td>address</td>
  76. <td>Address of the Modelverse</td>
  77. <td><a class="reference external" href="http://localhost:8001">http://localhost:8001</a></td>
  78. </tr>
  79. <tr class="row-odd"><td>file</td>
  80. <td>File to be compiled</td>
  81. <td>file.alc</td>
  82. </tr>
  83. <tr class="row-even"><td>username</td>
  84. <td>Username to use when compiling</td>
  85. <td>test_user</td>
  86. </tr>
  87. <tr class="row-odd"><td>object</td>
  88. <td>Object name to export to</td>
  89. <td>object.o</td>
  90. </tr>
  91. <tr class="row-even"><td>mode</td>
  92. <td>Either CO (constructors) or PO (graph)</td>
  93. <td>PO</td>
  94. </tr>
  95. </tbody>
  96. </table>
  97. </div>
  98. <div class="section" id="execute-model-py">
  99. <h2>execute_model.py<a class="headerlink" href="#execute-model-py" title="Permalink to this headline">¶</a></h2>
  100. <p>Compile a model and action language files together, executing the action language.
  101. First, all models are added, and then the action language is executed, starting at function &#8220;main&#8221;.
  102. Models being created are temporary, so they need to be exported before they can be accessed in the action language.</p>
  103. <p>Invocation:</p>
  104. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">execute_model</span><span class="o">.</span><span class="n">py</span> <span class="n">address</span> <span class="n">username</span> <span class="n">file1</span> <span class="n">file2</span> <span class="o">...</span>
  105. </pre></div>
  106. </div>
  107. <table border="1" class="docutils">
  108. <colgroup>
  109. <col width="19%" />
  110. <col width="53%" />
  111. <col width="28%" />
  112. </colgroup>
  113. <thead valign="bottom">
  114. <tr class="row-odd"><th class="head">Parameter name</th>
  115. <th class="head">Description</th>
  116. <th class="head">Example</th>
  117. </tr>
  118. </thead>
  119. <tbody valign="top">
  120. <tr class="row-even"><td>address</td>
  121. <td>Address of the Modelverse</td>
  122. <td><a class="reference external" href="http://localhost:8001">http://localhost:8001</a></td>
  123. </tr>
  124. <tr class="row-odd"><td>username</td>
  125. <td>Username to use when compiling</td>
  126. <td>test</td>
  127. </tr>
  128. <tr class="row-even"><td>file</td>
  129. <td>File to compile (either .mvc or .alc)</td>
  130. <td>test.alc</td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. </div>
  135. <div class="section" id="fix-files-py">
  136. <h2>fix_files.py<a class="headerlink" href="#fix-files-py" title="Permalink to this headline">¶</a></h2>
  137. <p>Fix some files that must be kept identical.
  138. This is sometimes necessary because if a file gets updated, the changes must propagate.
  139. Usually, this is done with symbolic links or similar, but there does not seem to be a nice cross-platform way of doing this in Git.</p>
  140. <p>Invocation:</p>
  141. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">fix_files</span><span class="o">.</span><span class="n">py</span>
  142. </pre></div>
  143. </div>
  144. </div>
  145. <div class="section" id="flush-compiler-caches-py">
  146. <h2>flush_compiler_caches.py<a class="headerlink" href="#flush-compiler-caches-py" title="Permalink to this headline">¶</a></h2>
  147. <p>Clear all cached files from the compiler.
  148. The compiler will automatically reparse files when they have been changed, but changes to the compiler code itself will not be detected.
  149. When changing the compiler, this file should be executed to flush these file caches.</p>
  150. <p>Invocation:</p>
  151. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">flush_compiler_caches</span><span class="o">.</span><span class="n">py</span>
  152. </pre></div>
  153. </div>
  154. </div>
  155. <div class="section" id="generate-bootstrap-py">
  156. <h2>generate_bootstrap.py<a class="headerlink" href="#generate-bootstrap-py" title="Permalink to this headline">¶</a></h2>
  157. <p>Creates the bootstrap file for the Modelverse State.
  158. This creates the necessary initial graph which contains links to all primitive code that is executed by the Modelverse before users can communicate with it.
  159. Generally, this needs to be executed when any file in the <em>bootstrap/</em> folder is modified.
  160. Compilation is fairly smart, only recompiling parts that have changed.</p>
  161. <p>Invocation:</p>
  162. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">generate_bootstrap</span><span class="o">.</span><span class="n">py</span>
  163. </pre></div>
  164. </div>
  165. </div>
  166. <div class="section" id="link-and-load-py">
  167. <h2>link_and_load.py<a class="headerlink" href="#link-and-load-py" title="Permalink to this headline">¶</a></h2>
  168. <p>This takes a set of objects in the Modelverse, links them together in a single &#8220;executable&#8221; and executes it immediately.
  169. Generally not needed by end-users.</p>
  170. <p>Invocation:</p>
  171. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">link_and_load</span><span class="o">.</span><span class="n">py</span> <span class="n">address</span> <span class="n">username</span> <span class="n">object1</span> <span class="n">object2</span> <span class="o">...</span>
  172. </pre></div>
  173. </div>
  174. <table border="1" class="docutils">
  175. <colgroup>
  176. <col width="19%" />
  177. <col width="53%" />
  178. <col width="28%" />
  179. </colgroup>
  180. <thead valign="bottom">
  181. <tr class="row-odd"><th class="head">Parameter name</th>
  182. <th class="head">Description</th>
  183. <th class="head">Example</th>
  184. </tr>
  185. </thead>
  186. <tbody valign="top">
  187. <tr class="row-even"><td>address</td>
  188. <td>Address of the Modelverse</td>
  189. <td><a class="reference external" href="http://localhost:8001">http://localhost:8001</a></td>
  190. </tr>
  191. <tr class="row-odd"><td>username</td>
  192. <td>Username to use when compiling</td>
  193. <td>test</td>
  194. </tr>
  195. <tr class="row-even"><td>object</td>
  196. <td>File to compile (either .mvc or .alc)</td>
  197. <td>test.alc</td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. </div>
  202. <div class="section" id="make-all-py">
  203. <h2>make_all.py<a class="headerlink" href="#make-all-py" title="Permalink to this headline">¶</a></h2>
  204. <p>Compile a set of files and executes them immediately.
  205. This uses constructors by default, which is the most elegant, but also the slowest.</p>
  206. <p>Invocation:</p>
  207. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">make_all</span><span class="o">.</span><span class="n">py</span> <span class="n">address</span> <span class="n">username</span> <span class="n">file1</span> <span class="n">file2</span> <span class="o">...</span>
  208. </pre></div>
  209. </div>
  210. <table border="1" class="docutils">
  211. <colgroup>
  212. <col width="19%" />
  213. <col width="53%" />
  214. <col width="28%" />
  215. </colgroup>
  216. <thead valign="bottom">
  217. <tr class="row-odd"><th class="head">Parameter name</th>
  218. <th class="head">Description</th>
  219. <th class="head">Example</th>
  220. </tr>
  221. </thead>
  222. <tbody valign="top">
  223. <tr class="row-even"><td>address</td>
  224. <td>Address of the Modelverse</td>
  225. <td><a class="reference external" href="http://localhost:8001">http://localhost:8001</a></td>
  226. </tr>
  227. <tr class="row-odd"><td>username</td>
  228. <td>Username to use when compiling</td>
  229. <td>test</td>
  230. </tr>
  231. <tr class="row-even"><td>file</td>
  232. <td>File to compile (either .mvc or .alc)</td>
  233. <td>test.alc</td>
  234. </tr>
  235. </tbody>
  236. </table>
  237. </div>
  238. <div class="section" id="make-parallel-py">
  239. <h2>make_parallel.py<a class="headerlink" href="#make-parallel-py" title="Permalink to this headline">¶</a></h2>
  240. <p>A parallel version of make_all.py.
  241. This uses the direct graph compilation, and compiles these graphs in parallel.
  242. This is much faster than make_all, though much less elegant.</p>
  243. <p>Invocation:</p>
  244. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">make_parallel</span><span class="o">.</span><span class="n">py</span> <span class="n">address</span> <span class="n">username</span> <span class="n">file1</span> <span class="n">file2</span> <span class="o">...</span>
  245. </pre></div>
  246. </div>
  247. <table border="1" class="docutils">
  248. <colgroup>
  249. <col width="19%" />
  250. <col width="53%" />
  251. <col width="28%" />
  252. </colgroup>
  253. <thead valign="bottom">
  254. <tr class="row-odd"><th class="head">Parameter name</th>
  255. <th class="head">Description</th>
  256. <th class="head">Example</th>
  257. </tr>
  258. </thead>
  259. <tbody valign="top">
  260. <tr class="row-even"><td>address</td>
  261. <td>Address of the Modelverse</td>
  262. <td><a class="reference external" href="http://localhost:8001">http://localhost:8001</a></td>
  263. </tr>
  264. <tr class="row-odd"><td>username</td>
  265. <td>Username to use when compiling</td>
  266. <td>test</td>
  267. </tr>
  268. <tr class="row-even"><td>file</td>
  269. <td>File to compile (either .mvc or .alc)</td>
  270. <td>test.alc</td>
  271. </tr>
  272. </tbody>
  273. </table>
  274. </div>
  275. <div class="section" id="prompt-py">
  276. <h2>prompt.py<a class="headerlink" href="#prompt-py" title="Permalink to this headline">¶</a></h2>
  277. <p>A generic prompt interface to the Modelverse.
  278. You can log in as a specific user and start sending input messages to the Modelverse as that user.
  279. All output sent by the Modelverse will be printed in the console.
  280. There is no logic in the prompt itself, making it completely generic.</p>
  281. <p>Invocation:</p>
  282. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">prompt</span><span class="o">.</span><span class="n">py</span>
  283. </pre></div>
  284. </div>
  285. </div>
  286. <div class="section" id="run-local-modelverse-py">
  287. <h2>run_local_modelverse.py<a class="headerlink" href="#run-local-modelverse-py" title="Permalink to this headline">¶</a></h2>
  288. <p>Locally runs an instance of the Modelverse at the requested port.
  289. This combines MvK and MvS at the same system, and actually makes a direct link between them, omitting the slow use of sockets.
  290. While this is kind of a hack at the moment, it is really necessary with the current low performance.
  291. To split them up, there just needs to be a statechart in between both of them (which is already written and working).</p>
  292. <p>Invocation:</p>
  293. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">run_local_modelverse</span><span class="o">.</span><span class="n">py</span> <span class="n">port</span>
  294. </pre></div>
  295. </div>
  296. <table border="1" class="docutils">
  297. <colgroup>
  298. <col width="27%" />
  299. <col width="59%" />
  300. <col width="14%" />
  301. </colgroup>
  302. <thead valign="bottom">
  303. <tr class="row-odd"><th class="head">Parameter name</th>
  304. <th class="head">Description</th>
  305. <th class="head">Example</th>
  306. </tr>
  307. </thead>
  308. <tbody valign="top">
  309. <tr class="row-even"><td>port</td>
  310. <td>Port to host the Modelverse on</td>
  311. <td>8001</td>
  312. </tr>
  313. </tbody>
  314. </table>
  315. </div>
  316. <div class="section" id="run-tests-py">
  317. <h2>run_tests.py<a class="headerlink" href="#run-tests-py" title="Permalink to this headline">¶</a></h2>
  318. <p>Run the tests for all parts of the Modelverse.</p>
  319. <p>Invocation:</p>
  320. <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">run_tests</span><span class="o">.</span><span class="n">py</span>
  321. </pre></div>
  322. </div>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. </div>
  328. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  329. <div class="sphinxsidebarwrapper">
  330. <h3><a href="index.html">Table Of Contents</a></h3>
  331. <ul>
  332. <li><a class="reference internal" href="#">How to run</a><ul>
  333. <li><a class="reference internal" href="#check-objects-py">check_objects.py</a></li>
  334. <li><a class="reference internal" href="#compile-py">compile.py</a></li>
  335. <li><a class="reference internal" href="#execute-model-py">execute_model.py</a></li>
  336. <li><a class="reference internal" href="#fix-files-py">fix_files.py</a></li>
  337. <li><a class="reference internal" href="#flush-compiler-caches-py">flush_compiler_caches.py</a></li>
  338. <li><a class="reference internal" href="#generate-bootstrap-py">generate_bootstrap.py</a></li>
  339. <li><a class="reference internal" href="#link-and-load-py">link_and_load.py</a></li>
  340. <li><a class="reference internal" href="#make-all-py">make_all.py</a></li>
  341. <li><a class="reference internal" href="#make-parallel-py">make_parallel.py</a></li>
  342. <li><a class="reference internal" href="#prompt-py">prompt.py</a></li>
  343. <li><a class="reference internal" href="#run-local-modelverse-py">run_local_modelverse.py</a></li>
  344. <li><a class="reference internal" href="#run-tests-py">run_tests.py</a></li>
  345. </ul>
  346. </li>
  347. </ul>
  348. <h4>Previous topic</h4>
  349. <p class="topless"><a href="components.html"
  350. title="previous chapter">Modelverse components</a></p>
  351. <h4>Next topic</h4>
  352. <p class="topless"><a href="actionlanguage.html"
  353. title="next chapter">Action Language</a></p>
  354. <div role="note" aria-label="source link">
  355. <h3>This Page</h3>
  356. <ul class="this-page-menu">
  357. <li><a href="_sources/howto.txt"
  358. rel="nofollow">Show Source</a></li>
  359. </ul>
  360. </div>
  361. <div id="searchbox" style="display: none" role="search">
  362. <h3>Quick search</h3>
  363. <form class="search" action="search.html" method="get">
  364. <div><input type="text" name="q" /></div>
  365. <div><input type="submit" value="Go" /></div>
  366. <input type="hidden" name="check_keywords" value="yes" />
  367. <input type="hidden" name="area" value="default" />
  368. </form>
  369. </div>
  370. <script type="text/javascript">$('#searchbox').show(0);</script>
  371. </div>
  372. </div>
  373. <div class="clearer"></div>
  374. </div>
  375. <div class="related" role="navigation" aria-label="related navigation">
  376. <h3>Navigation</h3>
  377. <ul>
  378. <li class="right" style="margin-right: 10px">
  379. <a href="genindex.html" title="General Index"
  380. >index</a></li>
  381. <li class="right" >
  382. <a href="actionlanguage.html" title="Action Language"
  383. >next</a> |</li>
  384. <li class="right" >
  385. <a href="components.html" title="Modelverse components"
  386. >previous</a> |</li>
  387. <li class="nav-item nav-item-0"><a href="index.html">Modelverse 0.4.0 documentation</a> &#187;</li>
  388. </ul>
  389. </div>
  390. <div class="footer" role="contentinfo">
  391. &#169; Copyright 2016, Yentl Van Tendeloo.
  392. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.6.
  393. </div>
  394. </body>
  395. </html>