Skip to content

Commit

Permalink
More improvements to Policy docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpwhite2 committed Mar 3, 2011
1 parent bd7f623 commit c6f6d80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
11 changes: 8 additions & 3 deletions doc/policy/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,14 @@ Task and Worker Stats
In all cases, the calculated date pairs are adjusted so the left
datetime is less than the right.

:param workers: TODO

:param tasknames: TODO
:param workers: The worker or workers to which to limit the search.
This can be a worker name as a string, an iterable of
worker names, or None in which case all workers are
queried.

:param tasknames: The task or tasks to which to limit the search. This
can be a task name as a string, an iterable of task
names, or None in which case all tasks are queried.


.. method:: tasks_failed(interval=None, workers=None, tasknames=None)
Expand Down
18 changes: 9 additions & 9 deletions doc/policy/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ policies code which would be better put elsewhere.
The restrictions also provide some measure of security, but they should not be
solely relied upon for this purpose.

There are both parse-time and run-time mechanisms which enfore this
There are both parse-time and run-time mechanisms which enforce this
environment. At parse-time, the policy source is checked for certain language
constructs which are available in the full Python language, but are not desired
in policies.
Expand All @@ -146,18 +146,18 @@ Restrictions
.. rubric:: Imports

No imports are allowed in policies. This includes the import statements
``import ...`` and ``from ... import ...`` as well as the builtin
``import ...`` and ``from ... import ...`` as well as the built-in
``__import__`` function.

Selected builtin modules are made available, including ``datetime``,
Selected built-in modules are made available, including ``datetime``,
``time``, ``calendar``, and ``math``. (Actually, they are wrappers around
those modules to prevent any details of those modules leaking into the
execution environment.)

.. rubric:: Defining functions and classes

Function and class definitions are not allowed in policies. This includes
the defintiions themselves, as well as their associated keywords
the definitions themselves, as well as their associated keywords
(``return``, ``yield``, etc). Functions defined using ``lambda`` are also
not permitted.

Expand All @@ -170,7 +170,7 @@ includes the ``exec`` statement and the builtin functions ``eval()``,

.. rubric:: Files

The builtin function ``open()`` is not permitted.
The built-in function ``open()`` is not permitted.

.. rubric:: Assignment

Expand Down Expand Up @@ -207,7 +207,7 @@ are prohibited, including ``getattr()``, ``setattr()``, ``hasattr()`` and

.. note:: Names are found by examining the policy source text. This means that
*any* use of the forbidden names are prohibited, even if they actually refer
to some other object. For instance, because the builtin ``type()`` function
to some other object. For instance, because the built-in ``type()`` function
is prohibited, policy code such as the following will produce errors:
``type = "MyType"``

Expand All @@ -218,7 +218,7 @@ The goal of the policy mechanism is to make it as robust in the face of
exceptions as possible. Care is taken in the implementation to prevent an
exception raised while one policy is executing from affecting other policies as
well as the Policy Manager process. Where exceptions must be prevented from
propogating further, the Policy Manager will attempt to print out the exception
propagating further, the Policy Manager will attempt to print out the exception
traceback.

Some details:
Expand Down Expand Up @@ -257,8 +257,8 @@ usage: ``python manage.py cmrun [options]``

The cmrun command runs both the ``cmpolicy`` and ``cmevents`` commands as
subprocesses. However, they share the command line options, so the log output
may not be garbled and some portions may be missing. For this reason, it is
reccomended that ``cmpolicy`` and ``cmevents`` be used directly.
may be garbled and some portions may be missing. For this reason, it is
recommended that ``cmpolicy`` and ``cmevents`` be used directly.


Common Issues
Expand Down

0 comments on commit c6f6d80

Please sign in to comment.