Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Here's what I did:

by Tuna (Friar)
on Aug 18, 2001 at 22:38 UTC ( [id://105936]=note: print w/replies, xml ) Need Help??


in reply to Data Structure Design

First, I can't say how amazing that all of you made time to answer my questions. Without you guys/gals, I probably wouldn't have a job, right now.

Here's how I solved it:

- Each config file has an accompanying ".hosts" file, whose contents are the hostnames of each machine in the cluster.
- Hosts 1-6 are contained on config_file.hosts
- Host 7 is contained in dnsfile_file.hosts

I have two hashes that I refer to in the code.

- %config_files - Keys = cluster directory, Value = an array ref to a list of each config file associated with that cluster.

- %config_params - Keys = config_file, Value = an array ref to a list containing config_file, config_file.hosts, user|preprocess.pl, user|postprocess.pl, and a file "weight"

foreach $componentDir ( keys %config_files ) { $abs_cluster_dir = join("/", "$configdir", "$componentDir"); @cluster_files = @{ $config_files{ $componentDir } }; $href_cluster_files = \@cluster_files; &process_cluster( $abs_cluster_dir, \@cluster_files, \%config_params, \$err_msg ); } sub process_cluster { # subroutine parameters my $cluster_dir = $_[ 0 ]; my $aref_cluster_files = $_[ 1 ]; my $href_config_params = $_[ 2 ]; my $sref_err_msg = $_[ 3 ]; my $clusterHost; my $config_file; my $counter; my $file; my @files_to_process; my $hosts_file; my @target_hosts; $counter = 0; foreach $file ( @{ $aref_cluster_files } ) { if (defined ( $href_config_params->{ $file } )) { $files_to_process[ $href_config_params->{ $file }[ 3 ]] = $f +ile; } } foreach $config_file ( @files_to_process ) { $hosts_file = new IO::File ( "$abs_cluster_dir/$config_file.host +s" );print "Hosts file = $hosts_file\n"; unless ( defined ($hosts_file )) { $$sref_err_msg = $!; return 0; } $counter = 0; while ( ! $hosts_file->eof() ) { $target_hosts[ $counter ] = ( $hosts_file->getline( ) ) ; chomp @target_hosts; $counter++; } $hosts_file->close( ); foreach $clusterHost ( @target_hosts ) { ####DO STUFF#### } }
The trick here, is to assign a numerical weight to each file that I need to process, so that I can populate an array of config files in the order that I need to process them!!!

Again, thanks to you all, I began to consider alternatives.

Steve

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2025-06-19 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.