.. _programmersguide: ****************** Programmer's Guide ****************** In This Section """"""""""""""" .. toctree:: :maxdepth: 1 .//tutorial .//keyconcepts .//monitoringjobs .//workingwithtaskresults .//troubleshooting .//internals Simple Example """""""""""""" Here is a very simple example application. It adds two numbers together and writes the result to the console. .. literalinclude:: .\..\..\code\ProgrammersGuide\SimpleTaskExample.py :language: python :linenos: Copy and paste the code into a python file and run. The application first connects and submits a task to the coordinator. Next, an agent will be assigned the work and execute the task in an isolated process. Finally, the result of the task is sent back to the client. If you're using an IDE like JetBrains PyCharm, step through the code line by line. Examine the messages written from the coordinator and agent consoles. Take note of how the coordinator and agent respond after stepping through each line. For example, stepping past :py:meth:`job.submit` will cause the coordinator console to log "added 1 tasks for job #1 to queue". What this means will be discussed later. .. image:: ..\\..\\Media\\StepThroughCode.PNG :align: center :alt: StepThroughCode Continue to experiment with this application. Try to add more tasks to the job, set the jobs's :py:meth:`task_environment `, or modify some of the job options. As this example shows, the basic structure and core pieces of an application written with the API are simple but powerful! Next Steps """""""""" With a rudimentary example application finished, explore the help system and move on to more advanced topics. The following sections give various topics in the API more treatment. +-----------------------------------+----------------------------------------------------------------+ | Title | Read this if you want to... | +===================================+================================================================+ | :ref:`Tutorial` | Read a step-by-step narrative of another sample application. | +-----------------------------------+----------------------------------------------------------------+ | :ref:`How To` | Get solutions to common patterns in the API. | +-----------------------------------+----------------------------------------------------------------+ | :ref:`Key Concepts` | Understand the key concepts and building blocks of the product.| +-----------------------------------+----------------------------------------------------------------+ | :ref:`Frequently Asked Questions` | Get answers to frequently asked questions. | +-----------------------------------+----------------------------------------------------------------+ | :ref:`Internals` | Gain a firm understanding of the internals of the product. | +-----------------------------------+----------------------------------------------------------------+ | :ref:`Library Reference` | Explore what is available in the API. | +-----------------------------------+----------------------------------------------------------------+