[Swift-user] __root__ in filename
Michael Wilde
wilde at anl.gov
Wed Dec 10 15:52:00 CST 2014
This example may be helpful:
$ cat -n regexpmap.swift
1 type file;
2
3 string fnames[] = [
4 "/data/dir/000001/f01.dat",
5 "/data/dir/000001/f02.dat",
6 "/data/dir/000002/f03.dat",
7 "/data/dir/000002/f04.dat",
8 "/data/dir/000003/f05.dat",
9 "/data/dir/000003/f06.dat"];
10
11 file data[]<array_mapper; files=fnames>;
12
13 file image[] <structured_regexp_mapper;
14 source=data,
15 match="(/data/dir/[0-9][0-9]*/.*?)dat$",
16 transform="\\1img">;
17
18 iterate i {
19 tracef(" data[%i] = %s\nimage[%i] = %s\n",
20 i, filename(data[i]),
21 i, filename(image[i]));
22 } until (i==6);
$ swift regexpmap.swift
Swift 0.95 RC5 swift-r7605 cog-r3874
RunID: run067
Progress: Wed, 10 Dec 2014 21:50:42+0000
data[0] = __root__/data/dir/000001/f01.dat
image[0] = __root__/data/dir/000001/f01.img
data[1] = __root__/data/dir/000001/f02.dat
image[1] = __root__/data/dir/000001/f02.img
data[2] = __root__/data/dir/000002/f03.dat
image[2] = __root__/data/dir/000002/f03.img
data[3] = __root__/data/dir/000002/f04.dat
image[3] = __root__/data/dir/000002/f04.img
data[4] = __root__/data/dir/000003/f05.dat
image[4] = __root__/data/dir/000003/f05.img
data[5] = __root__/data/dir/000003/f06.dat
image[5] = __root__/data/dir/000003/f06.img
Final status:Wed, 10 Dec 2014 21:50:42+0000
On 12/10/14 3:21 PM, Mihael Hategan wrote:
> Hi,
>
> In 0.95 this is a bit of a known problem. This should be fixed in trunk.
> A backport of the fix may be possible and should probably be done. Can
> you easily switch to trunk? If not, I'll try to do the backport sooner.
>
> Mihael
>
> On Wed, 2014-12-10 at 15:11 -0600, Ketan Maheshwari wrote:
>> Hi,
>>
>> In an app that needs input files with same name but different extension, I
>> am trying to use regexp on the filename() of a mapped file. However, Swift
>> adds '__root__' to the path of file which cause the file to be not found in
>> the new location resulting in error as:
>>
>> org.griphyn.vdl.mapping.MissingDataException: File not found for
>> variable 'in_sto':
>> file://localhost/__root__/lcrc/project/NEXTGENOPT/DSP_old/examples/smps/dcap/dcap332_500.sto
>>
>> Relevant code is:
>>
>> file timfiles[]<filesys_mapper;
>> location="/lcrc/project/NEXTGENOPT/DSP_old/examples/smps/dcap",
>> pattern="*.tim">;
>> file in_sto <single_file_mapper; file=regexp(filename(timfiles[0]), "tim",
>> "sto")>;
>>
>> Thanks for any workaround suggestions for this,
>> Ketan
>> _______________________________________________
>> Swift-user mailing list
>> Swift-user at ci.uchicago.edu
>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
--
Michael Wilde
Mathematics and Computer Science Computation Institute
Argonne National Laboratory The University of Chicago
More information about the Swift-user
mailing list