Re: [MTT users] funclet and quoting

2007-06-14 Thread Jeff Squyres

On Jun 12, 2007, at 6:00 PM, Ethan Mallove wrote:


We'll need to revamp all the current funclets to accept
arrays and  return [potentially] arrays of arrays.  What
if, as a  counterproposal, we have a () funclet?
Then you could do the  following:

btls = ("if ($hostname =~ /foo/) { \
return ("self,sm,tcp");  \
} elsif ($hostname =~ /bar/) {   \
return ("udapl");\
} else { \
return ("sm", "tcp", "sm,tcp", "udapl", "sm,udapl"); \
}")


I like that. Is that in anticipation of having (),
(), (), (), (), ... ?


Well, I wasn't really thinking of adding all those other  
languages...  :-)



To reduce some
clutter, maybe a param like this would be fun, e.g.,

  default_ini_evaluator = perl

So MTT will assume you mean () if there's
no leading '&'.


Hrm.  How would you reconcile this with today's evaluation?  E.g.:

foo = bar

This is not legal perl, and would cause an error if we subject that  
to an internal perl eval.  This is why I was suggesting a ()  
funclet -- we would know that the entire contents were perl and safe  
to submit to eval.


--
Jeff Squyres
Cisco Systems



Re: [MTT users] funclet and quoting

2007-06-12 Thread Ethan Mallove
On Tue, Jun/12/2007 04:53:21PM, Jeff Squyres wrote:
> On Jun 12, 2007, at 10:50 AM, Ethan Mallove wrote:
> 
> >>> eval $btls = MTT::Functions::if(MTT::Functions::regexp
> >>> (MTT::Functions::shell("hostname"), "v440-2|v20z-2"),
> >>>  MTT::Functions::enumerate("self,sm,tcp"),
> >>>  MTT::Functions::if("MTT::Functions::regexp
> >>> ("MTT::Functions::shell("hostname"), "v440-6"),
> >>>  MTT::Functions::enumerate("udapl"),
> >>>  MTT::Functions::enumerate("sm", "tcp",
> >>> "sm,tcp", "udapl", "sm,udapl")
> >>>  )
> >>>  )
> >>
> >> Ah -- I had to think about this a bit before I figured it out/
> >> remembered.  I think we won't get the expansion effect if you do it
> >> this way.
> >
> > No expansion effect? As long as the perl code evaluates to
> > an array, couldn't it to work? E.g.,
> 
> We'll need to revamp all the current funclets to accept
> arrays and  return [potentially] arrays of arrays.  What
> if, as a  counterproposal, we have a () funclet?
> Then you could do the  following:
> 
> 
> 
> btls = ("if ($hostname =~ /foo/) { \
> return ("self,sm,tcp");  \
> } elsif ($hostname =~ /bar/) {   \
> return ("udapl");\
> } else { \
> return ("sm", "tcp", "sm,tcp", "udapl", "sm,udapl"); \
> }")
>
> 
> 
> (or something like that)
>

I like that. Is that in anticipation of having (),
(), (), (), (), ... ?  To reduce some
clutter, maybe a param like this would be fun, e.g.,

  default_ini_evaluator = perl

So MTT will assume you mean () if there's
no leading '&'.

Other legal options being ...

  default_ini_evaluator = python
  default_ini_evaluator = sh
  default_ini_evaluator = tcl
  default_ini_evaluator = ...

-Ethan


> 
> 
> 
> -- 
> Jeff Squyres
> Cisco Systems
> 
> ___
> mtt-users mailing list
> mtt-us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-users


Re: [MTT users] funclet and quoting

2007-06-12 Thread Jeff Squyres

On Jun 12, 2007, at 10:50 AM, Ethan Mallove wrote:


eval $btls = MTT::Functions::if(MTT::Functions::regexp
(MTT::Functions::shell("hostname"), "v440-2|v20z-2"),
 MTT::Functions::enumerate("self,sm,tcp"),
 MTT::Functions::if("MTT::Functions::regexp
("MTT::Functions::shell("hostname"), "v440-6"),
 MTT::Functions::enumerate("udapl"),
 MTT::Functions::enumerate("sm", "tcp",
"sm,tcp", "udapl", "sm,udapl")
 )
 )


Ah -- I had to think about this a bit before I figured it out/
remembered.  I think we won't get the expansion effect if you do it
this way.


No expansion effect? As long as the perl code evaluates to
an array, couldn't it to work? E.g.,


We'll need to revamp all the current funclets to accept arrays and  
return [potentially] arrays of arrays.  What if, as a  
counterproposal, we have a () funclet?  Then you could do the  
following:




btls = ("if ($hostname =~ /foo/) { \
   return ("self,sm,tcp");  \
   } elsif ($hostname =~ /bar/) {   \
   return ("udapl");\
   } else { \
   return ("sm", "tcp", "sm,tcp", "udapl", "sm,udapl"); \
   }")



(or something like that)



--
Jeff Squyres
Cisco Systems



Re: [MTT users] funclet and quoting

2007-06-12 Thread Ethan Mallove
On Tue, Jun/12/2007 08:07:20AM, Jeff Squyres wrote:
> On Jun 11, 2007, at 6:02 PM, Ethan Mallove wrote:
> 
> > btls = ("("("hostname")", "v440-2|v20z-2")", \
> >"("self,sm,tcp")", \
> >"("("("hostname")", "v440-6")", \
> >"("udapl")", \
> >"("sm", "tcp", "sm,tcp", "udapl",  
> > "sm,udapl")"" \
> >) \
> >)
> 
> Yowza!  We really need to make this quoting situation better  
> somehow.  :-(
> 
> Don't you have an extra ) in there at the end?
> 
> > How come EvaluateString() doesn't translate this:
> >
> > btls = ("("("hostname")", "v440-2|v20z-2")", \
> >"("self,sm,tcp")", \
> >"("("("hostname")", "v440-6")", \
> >"("udapl")", \
> >"("sm", "tcp", "sm,tcp", "udapl",  
> > "sm,udapl")"" \
> >) \
> >)
> >
> > Into one big eval block like this:
> >
> > eval $btls = MTT::Functions::if(MTT::Functions::regexp 
> > (MTT::Functions::shell("hostname"), "v440-2|v20z-2"),
> >  MTT::Functions::enumerate("self,sm,tcp"),
> >  MTT::Functions::if("MTT::Functions::regexp 
> > ("MTT::Functions::shell("hostname"), "v440-6"),
> >  MTT::Functions::enumerate("udapl"),
> >  MTT::Functions::enumerate("sm", "tcp",  
> > "sm,tcp", "udapl", "sm,udapl")
> >  )
> >  )
> >
> > So we could put the burden of the nasty recursive
> > parenthesis/quote parsing on perl, rather than MTT. That
> > would seem to naturally make the INI funclet syntax more
> > Perl-like.
> 
> Ah -- I had to think about this a bit before I figured it out/ 
> remembered.  I think we won't get the expansion effect if you do it  
> this way.  

No expansion effect? As long as the perl code evaluates to
an array, couldn't it to work? E.g.,

  exec = mpirun --mca btl @btls@ ...

  # Returns an array
  btls = ("sm", "tcp")

So EvaluateString() would do only this:

  * Substitute all () with MTT::Functions::funcs()
  * Substitute all $vars with same-INI-section params
  * Backslash escape @ symbols so they show up as strings in
the eval'd result
  * Perform an "eval" on the final string
  * Iterate over the result of the above step's string,
replacing "@multiplier" strings with the corresponding
element of the @multiplier array 

> Although it might solve some other issues (e.g., https:// 
> svn.open-mpi.org/trac/mtt/ticket/184)...?
>

The mess atop this email would simplify to:

btls =  if ($hostname =~ /foo/) {\
return ("self,sm,tcp");  \
} elsif ($hostname =~ /bar/) {   \
return ("udapl");\
} else { \
return ("sm", "tcp", "sm,tcp", "udapl", "sm,udapl"); \
}

-Ethan


> -- 
> Jeff Squyres
> Cisco Systems
> 
> ___
> mtt-users mailing list
> mtt-us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-users


Re: [MTT users] funclet and quoting

2007-06-12 Thread Jeff Squyres

On Jun 11, 2007, at 6:02 PM, Ethan Mallove wrote:


btls = ("("("hostname")", "v440-2|v20z-2")", \
   "("self,sm,tcp")", \
   "("("("hostname")", "v440-6")", \
   "("udapl")", \
   "("sm", "tcp", "sm,tcp", "udapl",  
"sm,udapl")"" \

   ) \
   )


Yowza!  We really need to make this quoting situation better  
somehow.  :-(


Don't you have an extra ) in there at the end?


How come EvaluateString() doesn't translate this:

btls = ("("("hostname")", "v440-2|v20z-2")", \
   "("self,sm,tcp")", \
   "("("("hostname")", "v440-6")", \
   "("udapl")", \
   "("sm", "tcp", "sm,tcp", "udapl",  
"sm,udapl")"" \

   ) \
   )

Into one big eval block like this:

eval $btls = MTT::Functions::if(MTT::Functions::regexp 
(MTT::Functions::shell("hostname"), "v440-2|v20z-2"),

 MTT::Functions::enumerate("self,sm,tcp"),
 MTT::Functions::if("MTT::Functions::regexp 
("MTT::Functions::shell("hostname"), "v440-6"),

 MTT::Functions::enumerate("udapl"),
 MTT::Functions::enumerate("sm", "tcp",  
"sm,tcp", "udapl", "sm,udapl")

 )
 )

So we could put the burden of the nasty recursive
parenthesis/quote parsing on perl, rather than MTT. That
would seem to naturally make the INI funclet syntax more
Perl-like.


Ah -- I had to think about this a bit before I figured it out/ 
remembered.  I think we won't get the expansion effect if you do it  
this way.  Although it might solve some other issues (e.g., https:// 
svn.open-mpi.org/trac/mtt/ticket/184)...?


--
Jeff Squyres
Cisco Systems