j-woz / exm-issues

Automatically exported from code.google.com/p/exm-issues
0 stars 0 forks source link

Feature: Multiple execs in app #363

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Describe new feature:

Allow multiple execs within an app, like Makefiles do: 

app (file o) process(file i) {
  echo "my sed script" > /tmp/t.sed
  sed -f /tmp/t.sed @i > @o
  echo "FOOTER" >> @o
}

Original issue reported on code.google.com by wozniak....@gmail.com on 5 Dec 2012 at 6:50

GoogleCodeExporter commented 9 years ago
Should require semicolons (not shown in example)

Original comment by wozniak....@gmail.com on 5 Dec 2012 at 6:50

GoogleCodeExporter commented 9 years ago
I agree with the motivation: writing wrapper scripts ends up being brittle and 
annoying.

I think we need to be careful though, I have a few concerns about language 
complexity and usability:
* We don't want a language-inside-a-language situation where they accumulate 
enough features to be a half-baked /bin/sh or are most of the way to being a 
regular Swift function.
* It could easily encourage bad coding habits, like using non-unique temporary 
filenames or creating and not cleaning up temporary files.  This seems to be 
the reason that a lot of makefiles break on parallel builds. 

I think there are a couple of ways we could go:
* Allow inline command line invocations in any Swift function, then you can use 
the regular Swift dataflow mechanisms to chain them, but without having to 
write the function boilerplate for each.
* Have a limited version of the above that is just multiple statements executed 
in sequence, plus a mechanism to allocate unique local temporary files.

Original comment by tim.g.ar...@gmail.com on 5 Dec 2012 at 9:31

GoogleCodeExporter commented 9 years ago
The example above does not use the currently working stdio redirection, which 
it should

Original comment by wozniak....@gmail.com on 5 Dec 2012 at 9:34

GoogleCodeExporter commented 9 years ago
I agree with the concerns in Comment 2.  Good point about the non-unique temp 
file.  

I only propose the functionality as offered by a Makefile.  Thus, we could 
require that the temp file is provided for the app by the output list.

Original comment by wozniak....@gmail.com on 5 Dec 2012 at 9:38

GoogleCodeExporter commented 9 years ago
Realization: we do need the in-app mktemp feature so we can create/use temp 
files on compute-node-local storage.  I also realize this might be a lot of 
work.

Original comment by wozniak....@gmail.com on 5 Dec 2012 at 9:46

GoogleCodeExporter commented 9 years ago
One thing you currently can do is: 

app (timing_file t) extract(output_file o)
{
  "tail" "-1" o "|" "cut" "-f" "2" "-d" "'" "'" @stdout=t;
}

Very nice!

Original comment by wozniak....@gmail.com on 7 Jan 2013 at 4:15