<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Thank you Justin. <br></span></div><div><span><br></span></div><div><span>One more question. I wrote the following program to get the machine location using readData(). But the program fails saying "foo.txt (No such file or directory)". Do you see any obvious bugs in the code below? Could you please help me to get this working ?<br></span></div><div><br><span></span></div><div style="font-style: italic; color: rgb(0, 0, 127);"><span>type messagefile;<br><br>app (messagefile t) get_machine_via_file(string fileName) {<br> getIP fileName stdout=@filename(t);<br>}<br><br>app (messagefile t) print (string m) {<br> echo m stdout=@filename(t);<br>}<br><br>messagefile machine_location
<simple_mapper;prefix="foo",suffix=".txt">;<br>messagefile output <simple_mapper;prefix="hoo",suffix=".txt">;<br><br>machine_location = get_machine_via_file("MyFile");<br>string s = readData(@filename(machine_location));<br>output= print(s);<br></span></div><div><br></div><div><br></div> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Justin M Wozniak <wozniak@mcs.anl.gov><br> <b><span style="font-weight: bold;">To:</span></b> swift-devel@ci.uchicago.edu <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, 24 April 2012 10:19 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Swift-devel] Assigning stdout to a string variable in Swift<br> </font> </div> <br>Hi
Emalayan<br> The only meaningful output from an app function is in files. I suggest <br>you put the output in a file and read it with readData().<br> Justin<br><br>On 04/24/2012 12:16 PM, Emalayan Vairavanathan wrote:<br>> Hi All,<br>><br>> Is it possible to assign a stdout to a string variable in Swift ?<br>><br>> I need to get the IP of a machine by executing an shell script and then<br>> assign it to a string variable. Please see the sample code pasted below<br>> (Here the string variable is written to a file to verify program works<br>> correctly). But the program didn't make any progress and swift was<br>> repeatedly printing a message called "Initializing site shared<br>> directory:1" on the console.<br>><br>> Any ideas ? Is this swift code is correct ? or swift does not support<br>> this feature ? In case if swift does not support this feature, is there<br>> a way
to use the stdout without writing to a file ?<br>><br>> Thank you<br>> Emalayan<br>><br>> 1) Source code<br>><br>> type messagefile;<br>><br>> app (string machine) get_machine (string fileName) {<br>> getIP fileName stdout = machine;<br>> }<br>><br>> app (messagefile t) printIP (string m) {<br>> echo m stdout=@filename(t);<br>> }<br>><br>> string IP = get_machine("myFile")<br>> messagefile outfile <simple_mapper;prefix="foo",suffix=".txt">;<br>> outfile = printIP(IP);<br>><br>> 2) Tc file:<br>><br>> localhost cat /bin/cat null null null<br>> localhost echo /bin/echo null null null<br>> localhost getIP<br>> /home/emalayan/Workspace/Mosa_March_12/tools/synthaticBenchmark/swift-scripts/pipeline-loc-aware/wrappers/getIP.sh<br>> null null null<br>><br>> 3)Site file:<br>><br>> <config><br>><br>> <pool handle="localhost"><br>> <filesystem
provider="local" /><br>> <execution provider="local" /><br>> <workdirectory>/home/emalayan/Mosa_March_12/tools/synthaticBenchmark/swift-scripts/pipeline-loc-aware/swift.work</workdirectory><br>> <profile namespace="karajan" key="jobThrottle">0</profile><br>> </pool><br>><br>> </config><br>><br>><br>> 4) stdout:<br>><br>> Swift 0.93 swift-r5483 cog-r3339<br>><br>> RunID: 20120424-0950-tkdyv925<br>> Progress: time: Tue, 24 Apr 2012 09:50:45 -0700<br>> Progress: time: Tue, 24 Apr 2012 09:51:15 -0700 Initializing site shared<br>> directory:1<br>> Progress: time: Tue, 24 Apr 2012 09:51:45 -0700 Initializing site shared<br>> directory:1<br>> Progress: time: Tue, 24 Apr 2012 09:52:15 -0700 Initializing site shared<br>> directory:1<br>> Progress: time: Tue, 24 Apr 2012 09:52:45 -0700 Initializing site shared<br>> directory:1<br>> Progress: time:
Tue, 24 Apr 2012 09:53:15 -0700 Initializing site shared<br>> directory:1<br>><br>><br>> _______________________________________________<br>> Swift-devel mailing list<br>> <a ymailto="mailto:Swift-devel@ci.uchicago.edu" href="mailto:Swift-devel@ci.uchicago.edu">Swift-devel@ci.uchicago.edu</a><br>> <a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a><br><br><br>-- <br>Justin M Wozniak<br>_______________________________________________<br>Swift-devel mailing list<br><a ymailto="mailto:Swift-devel@ci.uchicago.edu" href="mailto:Swift-devel@ci.uchicago.edu">Swift-devel@ci.uchicago.edu</a><br><a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a><br><br><br> </div> </div> </div></body></html>