Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to tell a child what to do?

by Corion (Patriarch)
on Sep 21, 2005 at 09:12 UTC ( [id://493697]=note: print w/replies, xml ) Need Help??


in reply to How to tell a child what to do?

I would use a database as the communication mechanism. That way, you get easy and convenient control over the jobs, when they were started and when they were finished (or hanging). For the job description, you can either come up with a keyword mechanism or consider to put the actual code to be run into the database - this makes for convenient extensibility.

Replies are listed 'Best First'.
Re^2: How to tell a child what to do?
by Eyck (Priest) on Sep 21, 2005 at 10:17 UTC

    I'm sorry, but it seems like you're playing with databases and everything looks like a nail.

    Proposing additional and significant external dependencies for a nice self-contained program is not very smart.

      I'm sorry that I misunderstood your problem. I thought that your statement:

      The hard part seems to be communicating with children, with one child, I would probably use STDIN/STDOUT, servers like apache have symmetrical children, so I'm kind of lost as to what is the best way to do something like that.

      implied that your children are not symmetrical and maybe even distributed across machines, and that children die-ing from unknown reasons might be common.

      Maybe you should discuss the scope of your program in the original post to some larger extent - I found DBD::SQLite a very convenient, lightweight and self-contained database, for example.

        While I used DBD::SQLite in few projects and also found it to be convenient, lightweight, and relatively self-contained when it comes to databases, database is not a solution for communication problem. unless it is, but I just fail to see the reason to go through all the hassle of seting up a database

        Since all the communication is with my own children, setting up an external file ( be it SQLite, which I fail to see how would it be relevant, something lighter like DB_File, or even single file with locking, or even socket with external daemon ), seems a tiny little bit overblown, don't you think?

          A reply falls below the community's threshold of quality. You may see it by logging in.

      You know it might actauly be a nail in some cases. It is odd that you ask a question and then are soo rude when you get an answer. Databases can be the right tool and they might not be. That depends entirely on your situation. If you wanted to have 100 children spread over 100 computers then a database would be a perfect solution. You said you wanted "possibly non-blocking and reliable way". Database is *one* of the answers that fits the question. For instances I work on windows and linux boxes and never feel comforatble with forking or "traditional" IPC. However I am always working with databases and most scripts I write use databases for something (not out of habit, i work with large sets of scheduling and accounting data in a database). In my case lots of times a DB is the easiest, fastest and most comfortable route for my problems. As far as we knew you where already connected to a DB and this would be a good solution.

      "Proposing additional and significant external dependencies for a nice self-contained program is not very smart." -- Considering we don't know the current dependencies of your program, we could hardly deduce that a database wouldn't fit your needs.

      Ask a question, get lots of answers, don't critise an answer or mock the person giving it just because it doesn't fit your need. We can't read your mind or know your particular needs or desires unless you tell us first. Sorry for the rant but its realy hurts to see someone try to help and provide a fair answer and be treated the way you tried corion.


      ___________
      Eric Hodges

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://493697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-28 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found