Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

In reply to Re: Pass/Fail Counter by little
in thread Pass/Fail Counter by Tuna

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-06-16 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.