bootstrap-vz/bootstrapvz/base/task.py

37 lines
881 B
Python
Raw Normal View History

2013-05-02 19:13:35 +02:00
class Task(object):
2014-03-23 19:37:25 +01:00
"""The task class represents a task that can be run.
2014-03-23 16:04:03 +01:00
It is merely a wrapper for the run function and should never be instantiated.
"""
# The phase this task is located in.
phase = None
2014-03-23 16:04:03 +01:00
# List of tasks that should run before this task is run
predecessors = []
2014-03-23 16:04:03 +01:00
# List of tasks that should run after this task has run
successors = []
2013-05-02 19:13:35 +02:00
class __metaclass__(type):
2014-03-23 16:04:03 +01:00
"""Metaclass to control how the class is coerced into a string
"""
def __repr__(cls):
2014-03-23 16:04:03 +01:00
"""
:return str: The full module path to the Task
2014-03-23 16:04:03 +01:00
"""
return cls.__module__ + '.' + cls.__name__
def __str__(cls):
2014-03-23 16:04:03 +01:00
"""
:return: The full module path to the Task
:rtype: str
2014-03-23 16:04:03 +01:00
"""
return repr(cls)
@classmethod
def run(cls, info):
2014-03-23 16:04:03 +01:00
"""The run function, all work is done inside this function
2014-03-23 19:37:25 +01:00
:param BootstrapInformation info: The bootstrap info object.
2014-03-23 16:04:03 +01:00
"""
pass