Actually what I understand that you have is a group of clusters
which can be referred to as a fram or a cluster itself. All units or
devices in a cluster (which can be hosts or clusters or both mixed)
are controlled by a special unit or device which we can call the
controller.
So regarding your previuos node I suggest you change once more the
structure of your data to somehow represent the relations inbetween
all of your hosts. That can be very simple.
(I know that others said something alike before.)
You said you have a cluster (or a farm) consisting of 5 clusters, so
that is the "Queen" as
kjherron called it. This is the number 1.
It has no parent. (Well,except you of course, but sadly you don't
count here.
grin) But as all of the devices must have a parent
we will make it its own parent. A very special case, but that will not
hurt nor break anything as this is the ONLY one that is parent of
itself.
It is supposed to wait for all the "workers", so the units / devices
it consists of. So we could call them children which have number 1 as
their parent.
Each unit needs to know its parent and it can have only one parent to
keep the relations easy.
This leads to:
ID; parentID; waitForID; unitName; type; description
1; 1; 1; farm; cluster; Queen of all
2; 1; 2; cluster_1; cluster; ...
3; 2; 3; h7; controller; princess of cluster_1
4; 3; 0; h1; host; worker
5; 3; 0; h2; host; worker
.
.
.
But ok, it might be better to normalize these relations so
As
bbfu stated out
here it would cost to much time
to alsways search for all units with a specific parentID to find the
children of a cluster or a controller. So it might be usefull to let
each unit know its parent and its children. But that can be done in
the way as
Nitsuj suggested and populating values for
$obj->parent and
$obj->children aside something alike
$obj->waitfor
upon initialization of each object. The waitfor is interesting as it
enables you to let a unit wait for any of the other units you have.
This way you can set the order of processing the tasks.
Another point would then be to implement
$obj->work returning 1 for
success or 0 for failure and
$obj->result.
I am just wondering if it would be somewhat an effort to call a script
on each host represented by (
$obj->type eq "host") that contacts the
assigned controller in a way alike "i am done" or using Religion.pm or
a DIE_Handler "i did not what you wanted me to do". So you don't need
to have a persistent connection to that host but then have to worry if
no reply comes at all, eg. in case of a system error, but thats a very
different problem or at least on a different level though.
I know this is all very general but forgive my laziness as you already
got "tons" of good code in reply to this and your previos posts
regarding this topic.
And for me it's not easy to type with one entire arm in cast. (yeah,
never again break to hard for pedestrians when you're on a bicycle :-)
Have a nice day
All decision is left to your taste
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.