Skip to content

Commit

Permalink
Match internal reference name with directory structure, updates to in…
Browse files Browse the repository at this point in the history
…ternal reference documentation and docstrings
  • Loading branch information
darjus committed Jun 10, 2016
1 parent d28eb30 commit e5fe05c
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 39 deletions.
54 changes: 53 additions & 1 deletion botoflow/decisions/decision_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,33 @@
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
"""
Decision bases are base classes for various decision classes, essentially grouping and reusing common bits between
actual decisions.
"""


class DecisionBase(object):
"""Every decision or decision base should inherit from this class
.. py:data:: decision
Contains a dictionary of decision attributes
"""

def __init__(self):
self.decision = dict()
self.decision = {}


class ActivityDecisionBase(DecisionBase):
"""Base for Activity decisions
"""

def __init__(self, decision_id):
"""
:param str decision_id: Decision ID
"""
super(ActivityDecisionBase, self).__init__()
self.decision_id = decision_id

Expand All @@ -28,7 +46,14 @@ def __repr__(self):


class RequestCancelExternalWorkflowDecisionBase(DecisionBase):
"""Base for requesting a cancellation of external workflow
"""

def __init__(self, workflow_id, run_id):
"""
:param str workflow_id: Workflow ID
:param str run_id: Run ID
"""
super(RequestCancelExternalWorkflowDecisionBase, self).__init__()
self.decision_id = (workflow_id, run_id)

Expand All @@ -39,7 +64,12 @@ def __repr__(self):


class RecordMarkerDecisionBase(DecisionBase):
"""Record marker decision base"""

def __init__(self, decision_id):
"""
:param str decision_id: Decision ID
"""
super(RecordMarkerDecisionBase, self).__init__()
self.decision_id = decision_id

Expand All @@ -49,7 +79,15 @@ def __repr__(self):


class SignalExternalWorkflowExecutionDecisionBase(DecisionBase):
"""Signalling for external workflow
"""

def __init__(self, workflow_id, run_id, signal_name):
"""
:param str workflow_id: Workflow ID
:param str run_id: Run ID
:param str signal_name: name of the signal to execute
"""
super(SignalExternalWorkflowExecutionDecisionBase, self).__init__()
self.decision_id = (workflow_id, run_id, signal_name)

Expand All @@ -61,7 +99,15 @@ def __repr__(self):


class StartChildWorkflowExecutionDecisionBase(DecisionBase):
"""Starting child workflow base
"""

def __init__(self, workflow_type_name, workflow_type_version, workflow_id):
"""
:param str workflow_type_name: Workflow type name
:param str workflow_type_version: version of the workflow
:param str workflow_id: Workflow ID
"""
super(StartChildWorkflowExecutionDecisionBase, self).__init__()
self.decision_id = (workflow_type_name, workflow_type_version,
workflow_id)
Expand All @@ -74,8 +120,13 @@ def __repr__(self):


class TimerDecisionBase(DecisionBase):
"""Timer decisions base
"""

def __init__(self, decision_id):
"""
:param str decision_id: Decision ID
"""
super(TimerDecisionBase, self).__init__()
self.decision_id = decision_id

Expand All @@ -85,6 +136,7 @@ def __repr__(self):


class WorkflowDecisionBase(DecisionBase):
"""Workflow decision base"""

def __init__(self):
super(WorkflowDecisionBase, self).__init__()
Expand Down
9 changes: 8 additions & 1 deletion botoflow/decorator_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

"""Internal: for use by decorators
"""Descriptors allow us to manipulate Python functions/methods at a much deeper level.
This is extremely useful for our workflow and activity decorators as descriptors allow us to perform different
actions depending on whether the call was made from the class or instance. Thereby allowing things like calling
activities from the workflow execution as if they were classmethod*s*.
To learn more about descriptors and using them, please check the official Python documentation: :ref:`descriptors`.
"""

import functools
from .context import get_context, StartWorkflowContext, DecisionContext
from .core import async
Expand Down
33 changes: 0 additions & 33 deletions docs/source/developer_reference/decisions.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Internal Reference
.. toctree::
:maxdepth: 3

developer_reference/index
internal_reference/index

==================
Indices and tables
Expand Down
6 changes: 6 additions & 0 deletions docs/source/internal_reference/activity_retrying.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Activity Retrying
=================

.. automodule:: botoflow.activity_retrying
:members:
:undoc-members:
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions docs/source/internal_reference/decisions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
=========
Decisions
=========

``decisions`` are classes/encapsulations of decisions we send to SWF.

Decision Bases
--------------

.. automodule:: botoflow.decisions.decision_bases
:members:
:undoc-members:

Decision List
-------------

.. automodule:: botoflow.decisions.decision_list
:members:
:undoc-members:

Decisions
---------

.. automodule:: botoflow.decisions.decisions
:members:
:undoc-members:


Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
=====================
decorator_descriptors
Decorator Descriptors
=====================

botoflow.decorator_descriptors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Internal Reference
==================

Internal reference documentation for botoflow developers.
.. note::

Internal reference documentation for botoflow developers.

.. toctree::
:maxdepth: 4

activity_retrying
core
decider
decisions
Expand Down
File renamed without changes.

0 comments on commit e5fe05c

Please sign in to comment.