Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Threaded Application Sequencing/Rendezvous

by BrowserUk (Pope)
on Jul 11, 2012 at 00:23 UTC ( #980985=note: print w/replies, xml ) Need Help??

in reply to Threaded Application Sequencing/Rendezvous

  • Configured via a markup language file
  • Provide a way to query current status and runtime statistics from the steps being executed
  • Be a turnkey solution that does not required a lot of work to install on a new system

Two out of three ain't bad :) And the third could be added fairly simply using a thread and a listener:

#! perl -slw use strict; my( %scripts, %deps, %sched, @starts ); while( <DATA> ) { chomp; my( $name, $script, @deps ) = split '[ \t:,]+'; $scripts{ $name } = $script; if( @deps ) { $deps{ $name } = { map{ $_ => 1 } @deps }; push @{ $sched{ $_ } }, $name for @deps; } else { push @starts, $name; } } my %running = map{ system( 1, $scripts{ $_ } ) => $_ } @starts; while( keys %running ) { my $donePid = wait; my $done = delete $running{ $donePid } or next; for my $action ( @{ $sched{ $done } } ) { delete $deps{ $action }{ $done }; next if keys %{ $deps{ $action } }; $running{ system( 1, $scripts{ $action } ) } = $action; } } __DATA__ Action1: Action1a: Action1 Action2: Action2a: Action2 Action3: Action1a, Action2a Action4: Action3 Action5: Action4 Action6: Action5 Action7: Action5 Action8: Action6, Action7 Action9: Action8 Action10: Action1a, Action2a Action11: Action8

And a run against action scripts that print "starting"; sleep 10; print "Ending":

[ 1:14:45.39] C:\test>980970 Action1 starting Action2 starting Action1 ending Action2 ending Action1a starting Action2a starting Action1a ending Action2a ending Action3 starting Action10 starting Action3 ending Action10 ending Action4 starting Action4 ending Action5 starting Action5 ending Action6 starting Action7 starting Action6 ending Action7 ending Action8 starting Action8 ending Action9 starting Action11 starting Action9 ending Action11 ending

Of course, it needs some error checking and system(1, ... ) only works on Windows, so that would need changing for other OSs, but as a starting point it shows that you don't need to get complicated for something like this.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: Threaded Application Sequencing/Rendezvous
by learnedbyerror (Scribe) on Jul 11, 2012 at 12:12 UTC

    This is interesting. While it doesn't provide a reporting framework, I can roll my own using an additional monitoring thread. I have mocked this up but didn't want to write it if there was some framework already available.

    I'll play around with this.

    Thanks, lbe

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://980985]
[holli]: it's probably the autist in you. I am like that too, no fucks given about what others think about me
james28909 checks, yep... htere are no fucks to give
[james28909]: another thing i am sick of is hurting others feelings
[1nickt]: james28909 You lost me a bit when you said "show me evolution from intelligence to ignorance". I guess we would have to define the terms, but as I look around at my species and how we are destroying our habitat ...
[james28909]: seems like a person cant even have a belief without hurting someones feelings. i never said my way is the only way. i just said i have pretty good scientific evidence, and then asked for opposing side to present evidence
[james28909]: was downvoted and left without a reply. go figure
[holli]: but then you DO give a fuck
[1nickt]: I don;t think beliefs should be down-voted, just behaviours.
[james28909]: im not quite how to explain it any better nick. you evolved from ignorance to intelligence. not the other way. the universe evolves from gas coulds and debris into planets stars and galaxies ect. it doesnt happen any other way. hence it has ....
[james28909]: some kind of logic behind it

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2017-12-15 14:29 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (433 votes). Check out past polls.