[Swift-devel] script mapper
Mihael Hategan
hategan at mcs.anl.gov
Wed Oct 31 19:59:03 CDT 2007
On Wed, 2007-10-31 at 19:44 -0500, Michael Wilde wrote:
> Very nice. Youre a step ahead as usual. Im sitting here with Andrew
> cranking data for the grant proposal and my head hurts.
>
> Would be nice to do a simple example with short names suitable for the
> mapper section of the user guide. if you get to that first, great, if
> not one of us will.
>
> Is this commited/commitable?
Committed.
>
>
> So the mapper is called "ext", takes a script via exec=, and then
> arbitrary mapper-specific args?
Yep. Except "exec", "input", "dbgname", and "descriptor" which are
unfortunately reserved. The alternative was to pass it a string but I
wanted to avoid quoting issues.
>
> And always is used to map an array?
You can map any data structure that swift supports. If you can express
it in swift, it should work.
>
> Im not sure this question makes sense, but can the same technique be
> used to shell out to a mapper that returns a struct or array of structs
> like the tabular mapper you did for Andrew?
Yes. Or a struct of arrays of structs and however much you want to
complicate this.
For example, you have a variable v of arbitrary type complexity. You
refer to one of its leaves using a path expression, say
v.a[10].left.next.a[78]. Then you make your script print the following
line:
a[10].left.next.a[78] path/to/the/file/this/maps/to
...
> The main difference being
> that the tabular file doesnt need to exist before the program starts?
The tabular file is limited to only certain structures (I think arrays
of structs). And, if I remember correctly what Ben mentioned, suffers
from deadlocks in certain cases.
The downside (?) to the external mapper is that the script must be on
the local machine, and is not something that goes into tc.data.
Mihael
>
> - Mike
>
>
> On 10/31/07 7:19 PM, Mihael Hategan wrote:
> > Well, there were no objections so here it is:
> >
> > file fs[]
> > <ext;exec="../php/list-frames.php",s=@arg("GPS_start_time"),e=@arg("GPS_end_time")>;
> >
> > foreach f in fs {
> > print(@filename(f));
> > }
> >
> > The script produces space separated pairs of a path and a file name. The
> > path is similar to what you would do in Swift. In the above case it
> > produces something like:
> >
> > [0] file1
> > [1] file2
> > etc.
> >
> > This can be used with arbitrary things, such as:
> > [0].somefield.array[3] file
> >
> > The mapper arguments, except "exec", are mapped to command line
> > arguments prefixed with a hyphen. So the above example causes the
> > following to happen:
> >
> > swift Plot1Chan.swift -GPS_start_time=877890090 -GPS_end_time=877543210
> > ...
> > list-frames.php -s 877890090 -e 877543210
> >
> > Mihael
> >
> > On Wed, 2007-10-31 at 17:21 -0500, Mihael Hategan wrote:
> >> I'm working on a script mapper for swift. Basically it allows executing
> >> some form of local executable which spells on stdout (swift_path,
> >> file_path) pairs. This was motivated by my unwilingness to deal with a
> >> potentially deadlocking swift because the CSV mapper was used wrong in
> >> I2U2/LIGO (didn't actually get there, but wanted to avoid it).
> >>
> >> I believe Mike suggested something like this anyway.
> >>
> >> If you think I'm going in the wrong direction, it would be nice if you
> >> said so before I get deeper into it.
> >>
> >> Mihael
> >>
> >> _______________________________________________
> >> Swift-devel mailing list
> >> Swift-devel at ci.uchicago.edu
> >> http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> >>
> >
> > _______________________________________________
> > Swift-devel mailing list
> > Swift-devel at ci.uchicago.edu
> > http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> >
> >
>
More information about the Swift-devel
mailing list