[noctool-devel] compact configurations for identical machines
Ingvar
ingvar at hexapodia.net
Fri May 23 06:04:37 UTC 2008
I wrotes:
> Jim writes:
> > I was thinking about what a bear it will be to have to specify each of my
> > compute node systems in my clusters individually.
> >
> > I was thinking about syntax such as the following that would create an
> > equipment object for each of 256 hosts named l001 through l256.
> >
> > (machine-cluster "LosLobos" linux-host
> > (user "download")
> > (disks
> > (disk "/dev/sda1" 80 95))
> > (machinerange "l001-l256"))
>
> It is definitely a cool idea. I am not ENTIRELY sure what the best syntax for
> the name range would be, but it's definitely something that would be handy for
> many users.
Say... If (and that may be a big "if") we can make sure that all 'top-level'
config macros have name as the first parameter...
Or, wait, even better!
Does this look at least vaguely sane?
(cluster ("rtr-~3,'0d" 1 10)
(machine name linux-host
(user "testuser")))
NOCTOOL> (noctool-config:load "test-files/cluster.cfg")
NIL
NOCTOOL> *equipment*
(#<LINUX-HOST {AB41929}> #<LINUX-HOST {AC64A31}> #<LINUX-HOST {ACB7291}>
#<LINUX-HOST {ACC26D9}> #<LINUX-HOST {AD35B39}> #<LINUX-HOST {AD40FA1}>
#<LINUX-HOST {AD4C3E9}> #<LINUX-HOST {AD57879}> #<LINUX-HOST {AD62CD9}>
#<LINUX-HOST {AD6E139}>)
NOCTOOL> (mapcar 'name *equipment*)
("rtr-001" "rtr-002" "rtr-003" "rtr-004" "rtr-005" "rtr-006" "rtr-007"
"rtr-008" "rtr-009" "rtr-010")
NOCTOOL>
That has just been tested, though not checked in. Mainly because I suspect
having C-style format strings as default is user-friendlier than having to use
CL format strings (yep "~3,'0d" is more-or-less the same as "%03d", if we OTOH
allow other format wossnames, it gets trickier). If it looks like something to
work from, I'll check it in later today.
(defmacro cluster ((fmt low high &optional (name nil) (c-fmt nil)) form)
(let ((format-string fmt) ;;; At some point, allow C-style format string
(name (or name
(get-config-symbol "NAME"))))
`(progn
,@(loop for n from low to high
for realname = (format nil format-string n)
collect (substitute realname name form)))))
This way, we allow clustering of any top-level config form, we aren't
restricted in the actual parameter (it defaults to substitute "name" but if
you prefer, you can replace "blahonga" or "supercallifragilistic" with each
generated name).
//Ingvar
More information about the Noctool-devel
mailing list