[Swift-user] app argument int passed as float
Mihael Hategan
hategan at mcs.anl.gov
Fri Oct 21 17:01:09 CDT 2011
This has been traditionally an issue with swift. Ints were internally
represented as a java Double.
I fixed that in trunk this summer, but it was after 0.93 was branched.
I'm not sure whether this should be a bug or a known issue in 0.93.
On Fri, 2011-10-21 at 16:51 -0500, Ketan Maheshwari wrote:
> I checked with trunk and this doesn't seem to be happening there. Will
> file a bug for 0.93.
>
> On Fri, Oct 21, 2011 at 3:10 PM, Ketan Maheshwari
> <ketancmaheshwari at gmail.com> wrote:
> Mike,
>
>
> Indeed the output seems to be as expected. I just tried this
> and worked for me. However, if you see the log, at the point
> where the arguments are passed to the worker it gets converted
> to float. See this line in the log of this run:
>
>
> 2011-10-21 15:05:03,291-0500 DEBUG vdl:execute2 JOB_START
> jobid=echo-suhonmhk tr=echo arguments=[foo, 35.0]
> tmpdir=km-20111021-1504-f4bc0xg4/jobs/s/echo-suhonmhk
> host=localhost
>
>
> 35 became 35.0 there.
>
> Regards,
> Ketan
>
>
> On Fri, Oct 21, 2011 at 2:38 PM, Michael Wilde
> <wilde at mcs.anl.gov> wrote:
> I tried this with an example closer to what you wrote
> in the initial message, Ketan.
>
> It still seems to work OK under the trunk rev
> indicated:
>
> bri$ cat km1.swift
> type outfile;
>
> app (outfile o ) myapp(string a, int b ){
> echo a b stdout=@o;
> }
>
> outfile out<"km1.out">;
>
> out = myapp("foo", 35 );
>
> bri$ swift km1.swift
>
> no sites file specified, setting to
> default: /home/wilde/swift/rev/trunk/etc/sites.xml
> Swift svn swift-r5234 cog-r3296
>
>
> RunID: 20111021-1436-z7s2z5rb
> Progress: time: Fri, 21 Oct 2011 14:37:01 -0500
> Final status: Fri, 21 Oct 2011 14:37:01 -0500
> Finished successfully:1
> bri$ cat km1.out
> foo 35
> bri$
>
> - Mike
>
>
>
> ----- Original Message -----
> > From: "Michael Wilde" <wilde at mcs.anl.gov>
> > To: "Ketan Maheshwari" <ketancmaheshwari at gmail.com>
> > Cc: "Swift User" <swift-user at ci.uchicago.edu>
> > Sent: Friday, October 21, 2011 2:33:48 PM
> > Subject: Re: [Swift-user] app argument int passed as
> float
> > In at least some recent version of trunk, ints seem
> to get passed ok,
> > as below.
> >
> > Now lets see where the difference is.
> >
> > - Mike
> >
> > bri$ cat args.swift
> > type file;
> >
> > app (file o) echo(int i)
> > {
> > echo i stdout=@o;
> > }
> >
> > file eo<"echo.out">;
> >
> > eo=echo(123);
> > bri$ which swift
> > ~/swift/rev/trunk/bin/swift
> > bri$ swift -version
> > no sites file specified, setting to default:
> > /home/wilde/swift/rev/trunk/etc/sites.xml
> > Swift svn swift-r5234 cog-r3296
> >
> > bri$ swift args.swift
> > no sites file specified, setting to default:
> > /home/wilde/swift/rev/trunk/etc/sites.xml
> > Swift svn swift-r5234 cog-r3296
> >
> > RunID: 20111021-1431-8mzx0ya2
> > Progress: time: Fri, 21 Oct 2011 14:31:04 -0500
> > Final status: Fri, 21 Oct 2011 14:31:04 -0500
> Finished successfully:1
> > bri$ cat echo.out
> > 123
> > bri$
> >
> >
> >
> > ----- Original Message -----
> > > From: "Ketan Maheshwari"
> <ketancmaheshwari at gmail.com>
> > > To: "Swift User" <swift-user at ci.uchicago.edu>
> > > Sent: Wednesday, October 19, 2011 8:30:24 PM
> > > Subject: [Swift-user] app argument int passed as
> float
> > > Hi,
> > >
> > >
> > > In my app definition, I have an argument of type
> int that is
> > > expected
> > > by the executable.
> > >
> > >
> > >
> > > I define my app something like this:
> > >
> > >
> > > (outfile o ) app myapp(string a, int b, datafile
> c, ...){
> > > cmd a b c stdout @o;
> > > }
> > >
> > >
> > > I call this as:
> > > <..mappers..>
> > >
> > >
> > > out = myapp("foo", 35, @afile, ...);
> > >
> > >
> > > However, it seems that at the time of the actual
> call, the value 35
> > > which is an int get replaced by the value 35.0, a
> float.
> > >
> > >
> > > I could see this from the arguments dumped by
> swift at the end of
> > > exception message:
> > >
> > >
> > > "
> > >
> > > Exception in presgt:
> > > Arguments: [TEST, 35.0, .....
> > > "
> > >
> > >
> > > The underlying app binary doesn't like because
> apparently the java
> > > is
> > > calling Integer.parseInt and getting a float
> formatted string.
> > >
> > > Any ideas?
> > >
> > >
> > > Regards, --
> > > Ketan
> > >
> > >
> > >
> > > _______________________________________________
> > > Swift-user mailing list
> > > Swift-user at ci.uchicago.edu
> > >
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
> >
> > --
> > Michael Wilde
> > Computation Institute, University of Chicago
> > Mathematics and Computer Science Division
> > Argonne National Laboratory
>
> --
> Michael Wilde
> Computation Institute, University of Chicago
> Mathematics and Computer Science Division
> Argonne National Laboratory
>
>
>
>
>
>
> --
> Ketan
>
>
>
>
>
>
>
> --
> Ketan
>
>
>
> _______________________________________________
> 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