concurrent.framework.samples.mandlebrot.app module
Sample application demostrating the implementation of the mandlebrot fractal
File: mandlebrot.app.py
-
class concurrent.framework.samples.mandlebrot.app.MandlebrotNode(compmgr, init=None, cls=<class 'concurrent.framework.samples.mandlebrot.app.MandlebrotNode'>)[source]
Bases: concurrent.framework.nodes.applicationnode.ApplicationNode
Application node distributing the computation of the mandlebrot set using an autonomous task system
-
app_init()[source]
Called just before the main entry. Used as the initialization point instead of the ctor
-
app_main()[source]
Applications main entry
-
factor
How many workloads does a single task get assigned, in our a workload is considered a row
-
get_task_system()[source]
Called from the base class when we are connected to a MasterNode and we are
able to send computation tasks over
-
height
Height of the mandlebrot set image
-
iters
Mandlebrot iterations per pixel
-
push_tasksystem_failed(result)[source]
We failed to push a ITaskSystem on the computation framework!
-
push_tasksystem_response(result)[source]
We just added a ITaskSystem on the framwork. Check result for more info
-
use_optimized_task
Should we use the data optimized task or the lazy task
-
width
Width of the mandlebrot set image
-
work_finished(result, task_system)[source]
Called when the work has been done, the results is what our ITaskSystem
sent back to us. Check resukt for more info
-
class concurrent.framework.samples.mandlebrot.app.MandlebrotSimpleNode(compmgr, init=None, cls=<class 'concurrent.framework.samples.mandlebrot.app.MandlebrotSimpleNode'>)[source]
Bases: concurrent.framework.nodes.applicationnode.ApplicationNode
Application node distributing the computation of the mandlebrot set using just tasks
-
app_init()[source]
Called just before the main entry. Used as the initialization point instead of the ctor
-
app_main()[source]
Applications main entry
-
check_finished()[source]
Check if we finsihed all computation or not
-
factor
How many workloads does a single task get assigned, in our a workload is considered a row
-
get_task_system()[source]
Called from the base class when we are connected to a MasterNode and we are
able to send computation tasks over
-
height
Height of the mandlebrot set image
-
iters
Mandlebrot iterations per pixel
-
push_task_failed(result)[source]
We failed to add a Task to the computation framework
-
push_task_response(result)[source]
We just add a Task to the computation framework
-
push_tasks_failed(result)[source]
We failed to add a set of Tasks to the computation framework
-
push_tasks_response(result)[source]
We just add a set of Tasks to the computation framework
-
send_task_batch
Should we send all tasks one by one or should we batch them into a hughe list
-
start_processing()[source]
Called when the app is not using a ITaskSystem and will instead just add tasks and
will take care of the task flow itself
-
task_finished(task, result, error)[source]
Called when a task has been done
-
use_optimized_task
Should we use the data optimized task or the lazy task
-
width
Width of the mandlebrot set image
-
class concurrent.framework.samples.mandlebrot.app.MandlebrotTask(name, system_id, client_id, **kwargs)[source]
Bases: concurrent.core.async.task.Task
-
clean_up()[source]
Called once a task has been performed and its results are about to be sent back. This is used
to optimize our network and to cleanup the tasks input data
-
finished(result, error)[source]
Once the task is finished. Called on the MasterNode within the main thread once
the node has recovered the result data.
-
class concurrent.framework.samples.mandlebrot.app.MandlebrotTaskOptimized(name, system_id, client_id, **kwargs)[source]
Bases: concurrent.core.async.task.Task
-
clean_up()[source]
Called once a task has been performed and its results are about to be sent back. This is used
to optimize our network and to cleanup the tasks input data
-
finished(result, error)[source]
Once the task is finished. Called on the MasterNode within the main thread once
the node has recovered the result data.
-
class concurrent.framework.samples.mandlebrot.app.MandlebrotTaskSystem(min_x, max_x, min_y, max_y, height, width, iters, factor, optimized)[source]
Bases: concurrent.core.async.api.ITaskSystem
The task system that is executed on the MasterNode and controls what jobs are required to be performed
-
do_post_run(result)[source]
Once the computation finsihed we reassamble the image here
-
gather_result(master)[source]
Once the system stated that it has finsihed the MasterNode will request the required results that
are to be send to the originator. Returns a tuple like (result, Error)
-
generate_tasks(master)[source]
Devide image in width part to distribute work
-
init_system(master)[source]
Initialize the system
-
is_complete(master)[source]
Ask the system if the computation has finsihed. If not we will go on and generate more tasks. This
gets performed every time a tasks finishes.
-
task_finished(master, task, result, error)[source]
Called once a task has been performed
-
concurrent.framework.samples.mandlebrot.app.do_mandel(x, y, max_iters)[source]
Given the real and imaginary parts of a complex number,
determine if it is a candidate for membership in the Mandelbrot
set given a fixed number of iterations.