Hi,

On 06.10.2008, at 17:35, Teyo Tyree wrote:
udo waechter wrote:

Hi,
On 03.10.2008, at 19:15, Luke Kanies wrote:


On Oct 3, 2008, at 4:37 AM, udo waechter wrote:

I would like to know how I could have many hosts export the
"same" (as in identical) resource. Is this possible?

As with non-exported resources, you can't have multiple instances of
the same resource.  How would it even make sense to have multiple
hosts trying to create the same file on a given machine? Who would
win?
Well, in this case I have one host that is the "master". Some or all
of the other hosts might need to trigger a certain configuration on
the "master".
This special case here is: Create a file that represents a template
for a queue. A queue might contain one host, or many.
I do not want to configure this resource on two hosts (the master
and all clients), but only on one (i.e. the "clients").

In this case there would be "at least one host" who configures (one
file on) another host. The question that I have still remains. Is
this somehow possible?

I'm still unclear on exactly what you're trying to do -- are you
trying to get information from each generating host into the file? If
so, use file fragments and join them on the server.

If not, can you explain more clearly?

Sorry for the unclearness. The content of the file on the server is the same, no matter which host exports it. There might be more of these files (for different queues, and then with different content). I do want to configure queues for the Sun Grid Engine. For this I need a template on the Gridmaster host. Hosts can be members of different queues (at least one). Each of the queues will be configured by exactly one template.

What I want to achieve is: Have a define (called "sge::queue", see my initial post on this topic) that is called on a (at least one) host.

for example

node client1, client2, client3{
    sge::queue{"testqueue": ....}
}
One approach would be to have each client export a fragment of information needed by the master to create the queue. The define would have to be per host though and the queue would be an attribute of the sqe::queue define i.e.

node client1, client2, client3 {
    sge::queue{"$hostname:
       queue => "testqueue",
       template=>"$hostnam_queue_frag.erb"
}

The trouble here is, that I also want to export that part of the template that does not change (i.e. is static).

So, here is my define:

define sge::queue(
                $queuename = "",
                $hostname = $fqdn,
                $group = "allhosts",
                $ensure = "present",
                $qtype = "BATCH",
                $prolog = "NONE",
                $epilog = "NONE",
                $user_lists = "NONE",
                $xuser_lists = "NONE"
                ){
        $name_real = $queuename ? {
                "" => $name,
                default => $queuename
        }
        $pcount_real = $processorcount ? {
                "" => "1",
                default => $processorcount
        }
        @@exec {"create_queuedir_${name_real}_${group}_${hostname}":
command => "mkdir -p ${sge_hosts_queue}/${name_real}/@${group}/$ {pcount_real}", onlyif => "test ! -d ${sge_hosts_queue}/${name_real}/@${group}/$ {pcount_real}",
                tag => "sge",
        }
@@file {"${sge_hosts_queue}/${name_real}/@${group}/${pcount_real}/$ {hostname}":
                ensure => $ensure,
                tag => "sge",
                notify =>  Exec["sge_queue_exec"],
        }
        #this if/else statement does not work as expected....
        if defined(File["queue.template-${name_real}"]){
                debug("already defined.")
        }else{
                @@file{"queue-template-${name_real}":
                        path => "${sge_collects}/queue.template-${name_real}",
                             ensure => $ensure,
                             tag => "sge_queue_template",
                             content => template("sge/queue.template.erb"),
                             notify =>  Exec["sge_queue_exec"],
                }
        }
}


and this is the queue.template.erb

seq_no                0
load_thresholds       np_load_avg=1.75
suspend_thresholds    NONE
nsuspend              1
suspend_interval      00:05:00
priority              0
min_cpu_interval      00:05:00
processors            UNDEFINED
qtype                 <%= qtype %>
ckpt_list             NONE
pe_list               make
rerun                 FALSE
tmpdir                /work/tmp
shell                 /bin/bash
prolog                <%= prolog %>
epilog                <%= epilog %>
shell_start_mode      posix_compliant
starter_method        NONE
suspend_method        NONE
resume_method         NONE
terminate_method      NONE
notify                00:00:60
owner_list            NONE
user_lists            <%= user_lists %>
xuser_lists           <%= xuser_lists %>
subordinate_list      NONE
complex_values        NONE
projects              NONE
xprojects             NONE
calendar              NONE
initial_state         enabled
s_rt                  INFINITY
h_rt                  INFINITY
s_cpu                 INFINITY
h_cpu                 INFINITY
s_fsize               INFINITY
h_fsize               INFINITY
s_data                INFINITY
h_data                INFINITY
s_stack               INFINITY
h_stack               INFINITY
s_core                INFINITY
h_core                INFINITY
s_rss                 INFINITY
h_rss                 INFINITY
s_vmem                INFINITY
h_vmem                INFINITY


This template shall then be created on the grid master exactly once.

There is a small bash-script, that takes all hosts, and automagically creates groups of hosts as well as fills the rest of this template.
What comes to my mind now, is that I can do a hack and replace:

                @@file{"queue-template-${name_real}":
                        path => "${sge_collects}/queue.template-${name_real}",
                             ensure => $ensure,
                             tag => "sge_queue_template",
                             content => template("sge/queue.template.erb"),
                             notify =>  Exec["sge_queue_exec"],
                }

above with:
                $queue_template_content = template("sge/queue.template.erb")
                @@exec{"queue-template-${name_real}-${hostname}":
command => "cat ${quue_template_content} > ${sge_collects}/ queue.template-${name_real}",
                        onlyif => "test ! -e 
${sge_collects}/queue.template-${name_real}",
                             tag => "sge_queue_template",
                             notify =>  Exec["sge_queue_exec"],
                }
This would still export the exec multiple times, but it would get executed only once due to the "onlyif" parameter. I do this already in the "define sge::queue". I do not like it though since it is a hack. But alas, at least it would work I guess.
I'll try it out later.

You would probably want to have the define place the fragments into a temp directory based on the queue name. In order to build the queue file on the master server, simply collect the resources and have an exec piece together the file from the fragments. If you have multiple masters serving different queues you could even specify the queue when collecting the exported resources:
Sge::queue<<| queue == "testqueue"|>>
This would not work for this case, since most of the information needed for the configuration of one queue is needed only once. The list of hosts is the only dynamic part in this template. That part is created with an external script.

I have classes called sge::exechost and sge::submithost and sge::master that do configure execution hosts (those that compute stuff), submit hosts (those that can submit jobs) and the master host, that manages the grid engine and does the scheduling of jobs.

A execution host has to be the member of at least one queue.

Perhaps, when you have this all working you can put together as a module and share it with the community.


I will gladly share this module. Most of the stuff works already. The queue management is the last thing that has to be implemented. We already use it to deploy the sun grid engine in our institute.

Thanks for the help,
udo.


--
:: udo waechter - [EMAIL PROTECTED] :: N 52º16'30.5" E 8º3'10.1"
:: genuine input for your ears: http://auriculabovinari.de
::                          your eyes: http://ezag.zoide.net
::                          your brain: http://zoide.net




Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to