[Swift-user] Externally controlled loop

Carolyn Phillips cphillips at mcs.anl.gov
Fri Aug 31 14:53:14 CDT 2012


I am working on Miday run by RCC at UChicago

[phillicl at midway-login2 ~]$ module display swift
-------------------------------------------------------------------
/software/modulefiles/swift/trunk:

module-whatis	setup swift trunk compiled with the system compiler
conflict	swift
module load	java/1.7
prepend-path	PATH	/software/swift-trunk-all/bin
prepend-path	LD_LIBRARY_PATH	/software/swift-trunk-all/lib
prepend-path	LIBRARY_PATH	/software/swift-trunk-all/lib
-------------------------------------------------------------------
[phillicl at midway-login2 ~]$ 


I 

On Aug 31, 2012, at 2:35 PM, Mihael Hategan <hategan at mcs.anl.gov> wrote:

> That looks like a bug in swift.
> 
> What version are you running this with (I see trunk, but how did you get
> it)?
> 
> Mihael
> 
> On Fri, 2012-08-31 at 14:24 -0500, Carolyn Phillips wrote:
>> Just to be certain I ran your exact script
>> 
>> cat b4.swift 
>> type file;
>> 
>> iterate passes {
>>   file passlog <"passes.log">;
>>   passlog = writeData(passes);
>> 
>>   int value = readData("errorlog");
>>   int readpasses = readData(passlog);
>> 
>>   tracef("%s: %i\n", "the value is", value);
>>   tracef("%s: %i\n", "Iteration :", passes);
>>   tracef("%s: %i\n", "Iteration Read :", readpasses);
>> 
>> } until (readpasses == 2);  # Determine if Done
>> 
>> 
>> [phillicl at midway-login1 TestSwift]$ swift b4.swift
>> no sites file specified, setting to default: /software/swift-trunk-all/etc/sites.xml
>> Swift trunk swift-r5901 cog-r3451
>> 
>> RunID: 20120831-1923-58gjhdrd
>> Progress:  time: Fri, 31 Aug 2012 19:23:29 +0000
>> Iteration :: 0
>> the value is: 0
>> Iteration Read :: 0
>> Execution failed:
>> 	java.lang.NullPointerException
>> 	at org.griphyn.vdl.mapping.AbstractDataNode.getType(AbstractDataNode.java:95)
>> 	at org.griphyn.vdl.karajan.lib.SwiftArg.unwrap(SwiftArg.java:57)
>> 	at org.griphyn.vdl.karajan.lib.SwiftArg.getValue(SwiftArg.java:77)
>> 	at org.griphyn.vdl.karajan.lib.Operators.vdlop_eq(Operators.java:216)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>> 	at org.globus.cog.karajan.workflow.nodes.functions.FunctionsCollection.function(FunctionsCollection.java:82)
>> 	at org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction.post(AbstractFunction.java:27)
>> 	at org.globus.cog.karajan.workflow.nodes.AbstractSequentialWithArguments.completed(AbstractSequentialWithArguments.java:194)
>> 	at org.globus.cog.karajan.workflow.nodes.FlowNode.complete(FlowNode.java:214)
>> 	at org.globus.cog.karajan.workflow.nodes.FlowContainer.post(FlowContainer.java:58)
>> 	at org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction.post(AbstractFunction.java:28)
>> 	at org.globus.cog.karajan.workflow.nodes.Sequential.startNext(Sequential.java:29)
>> 	at org.globus.cog.karajan.workflow.nodes.Sequential.executeChildren(Sequential.java:20)
>> 	at org.globus.cog.karajan.workflow.nodes.FlowContainer.execute(FlowContainer.java:63)
>> 	at org.globus.cog.karajan.workflow.nodes.FlowNode.restart(FlowNode.java:139)
>> 	at org.globus.cog.karajan.workflow.nodes.FlowNode.start(FlowNode.java:197)
>> 	at org.globus.cog.karajan.workflow.FlowElementWrapper.start(FlowElementWrapper.java:227)
>> 	at org.globus.cog.karajan.workflow.events.EventBus.start(EventBus.java:98)
>> 	at org.globus.cog.karajan.workflow.events.EventTargetPair.run(EventTargetPair.java:40)
>> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>> 	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>> 	at java.lang.Thread.run(Thread.java:722)
>> 
>> 
>> On Aug 31, 2012, at 2:20 PM, Carolyn Phillips <cphillips at mcs.anl.gov> wrote:
>> 
>>> Execution failed:
>>> 	java.lang.NullPointerException
>>> 	at org.griphyn.vdl.mapping.AbstractDataNode.getType(AbstractDataNode.java:95)
>>> 	at org.griphyn.vdl.karajan.lib.SwiftArg.unwrap(SwiftArg.java:57)
>>> 	at org.griphyn.vdl.karajan.lib.SwiftArg.getValue(SwiftArg.java:77)
>>> 	at org.griphyn.vdl.karajan.lib.Operators.vdlop_eq(Operators.java:216)
>>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>>> 	at org.globus.cog.karajan.workflow.nodes.functions.FunctionsCollection.function(FunctionsCollection.java:82)
>>> 	at org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction.post(AbstractFunction.java:27)
>>> 	at org.globus.cog.karajan.workflow.nodes.AbstractSequentialWithArguments.completed(AbstractSequentialWithArguments.java:194)
>>> 	at org.globus.cog.karajan.workflow.nodes.FlowNode.complete(FlowNode.java:214)
>>> 	at org.globus.cog.karajan.workflow.nodes.FlowContainer.post(FlowContainer.java:58)
>>> 	at org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction.post(AbstractFunction.java:28)
>>> 	at org.globus.cog.karajan.workflow.nodes.Sequential.startNext(Sequential.java:29)
>>> 	at org.globus.cog.karajan.workflow.nodes.Sequential.executeChildren(Sequential.java:20)
>>> 	at org.globus.cog.karajan.workflow.nodes.FlowContainer.execute(FlowContainer.java:63)
>>> 	at org.globus.cog.karajan.workflow.nodes.FlowNode.restart(FlowNode.java:139)
>>> 	at org.globus.cog.karajan.workflow.nodes.FlowNode.start(FlowNode.java:197)
>>> 	at org.globus.cog.karajan.workflow.FlowElementWrapper.start(FlowElementWrapper.java:227)
>>> 	at org.globus.cog.karajan.workflow.events.EventBus.start(EventBus.java:98)
>>> 	at org.globus.cog.karajan.workflow.events.EventTargetPair.run(EventTargetPair.java:40)
>>> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>>> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>> 	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>>> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>>> 	at java.lang.Thread.run(Thread.java:722)
>>> 
>>> On Aug 31, 2012, at 2:17 PM, Mihael Hategan <hategan at mcs.anl.gov> wrote:
>>> 
>>>> Should work. What's the exact error you are getting?
>>>> 
>>>> $ swift b4.swift
>>>> no sites file specified, setting to
>>>> default: /home/mike/work/cog-svn/cogkit/trunk/current/src/cog/modules/swift/dist/swift-svn/etc/sites.xml
>>>> Swift trunk swift-r5739 (swift modified locally) cog-r3088 (cog modified
>>>> locally)
>>>> 
>>>> RunID: 20120831-1215-i0n6v30e
>>>> Progress:  time: Fri, 31 Aug 2012 12:15:09 -0700
>>>> Iteration :: 0
>>>> Iteration Read :: 0
>>>> the value is: 1
>>>> Iteration :: 1
>>>> the value is: 1
>>>> Iteration Read :: 1
>>>> Iteration :: 2
>>>> the value is: 1
>>>> Iteration Read :: 2
>>>> Final status: Fri, 31 Aug 2012 12:15:09 -0700
>>>> 
>>>> $ cat b4.swift
>>>> type file;
>>>> 
>>>> iterate passes {
>>>>  file passlog <"passes.log">;
>>>>  passlog = writeData(passes);
>>>> 
>>>>  int value = readData("errorlog");
>>>>  int readpasses = readData(passlog);
>>>> 
>>>>  tracef("%s: %i\n", "the value is", value);
>>>>  tracef("%s: %i\n", "Iteration :", passes);
>>>>  tracef("%s: %i\n", "Iteration Read :", readpasses);
>>>> 
>>>> } until (readpasses == 2);  # Determine if Done
>>>> 
>>>> $
>>>> 
>>>> 
>>>> On Fri, 2012-08-31 at 12:02 -0500, Carolyn Phillips wrote:
>>>>> Hello,
>>>>> 
>>>>> So I want to create an externally controlled loop, meaning, the number of times the loop repeats is determined by the output of a executable called within the loop.  That output is written to a file so it can be read and checked.   I am experimenting with getting a very rudimentary set up.   Below you can see that I have two lines that determine if the iteration is done, one based on the variable "passes" and the other based on the variable "read passes" that is read from a file.  The second does not work and throws a execution failed exception.     Any advice on how to make this kind of structure work?
>>>>> 
>>>>> type file;
>>>>> 
>>>>> iterate passes {
>>>>> 
>>>>> 
>>>>>  # try writing the iteration to a log file
>>>>>  file passlog <"passes.log">;
>>>>>  passlog = writeData(passes);
>>>>> 
>>>>>  # try reading from another log file
>>>>>  int value = readData("errorlog");
>>>>>  int readpasses = readData(passlog);
>>>>> 
>>>>>  # Write to the Output Log 
>>>>>  int i = 3;
>>>>>  tracef("%s: %i\n", "the value is", value); 
>>>>>  tracef("%s: %i\n", "Iteration :", passes);
>>>>>  tracef("%s: %i\n", "Iteration Read :", readpasses);
>>>>> 
>>>>> #} until (readpasses == 2);  # Determine if Done
>>>>> } until (passes == 2);  # Determine if Done
>>>>> _______________________________________________
>>>>> Swift-user mailing list
>>>>> Swift-user at ci.uchicago.edu
>>>>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>>>> 
>>>> 
>>> 
>> 
> 
> 




More information about the Swift-user mailing list