Sorry for bringing this back but I am having an issue with the 
example_watch_folder.pl script.  After running in and put a fasta file, it gets 
copied over but it is empty.  Any idea how to fix this issue.

Uploaded by: galaxy@
Date uploaded: 2013-05-30
File size: 0 bytes
Data type: txt
Build: ?
Miscellaneous information: Uploaded temporary file (/tmp/API/myseq.fasta) does 
not exist.
empty
Database/Build: ?
Number of data lines: None
Disk file: /usr/local/galaxy/galaxy-dist/database/files/000/dataset_299.dat


Thank you for your help,

Regards
From: galaxy-dev-boun...@lists.bx.psu.edu 
[mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Dannon Baker
Sent: Thursday, May 09, 2013 6:48 AM
To: neil.burd...@csiro.au
Cc: Galaxy Dev
Subject: Re: [galaxy-dev] Getting example_watch_folder.py to work...

Hey Neil,

A user browsing that history wouldn't automatically get the updates (unless the 
history was already refreshing for some reason), but they definitely would upon 
refresh.  Glad you got the rest working!

-Dannon

On Thu, May 9, 2013 at 2:02 AM, 
<neil.burd...@csiro.au<mailto:neil.burd...@csiro.au>> wrote:
Hi all,
          I finally resolved the issue I'll mention it here to help anyone else 
who has the same issue. In "Edit" mode on the workflow you add the "Workflow 
control->Inputs" to use the api.

Final question....
Everything gets created and stored in the database, but the history column on 
the left of the browser doesn't get updated. Can user see if the task has 
completed successfully and all files uploaded from the browser?

Thanks
Neil

From: Burdett, Neil (ICT Centre, Herston - RBWH)
Sent: Thursday, 9 May 2013 2:56 PM

To: galaxy-dev@lists.bx.psu.edu<mailto:galaxy-dev@lists.bx.psu.edu>
Subject: Getting example_watch_folder.py to work...

Hi,

       I'm still struggling to get the example_watch_folder.py to work. So any 
help much appreciated.

I've created a simple workflow, which essentially opens a text file and then 
writes out the data to a html file.

My xml file:
<tool id="CopyTool" name="Copy Tool">
  <description>Test</description>
  <command interpreter="perl">$__root_dir__/tools/copy/copy.pl<http://copy.pl>
          --input_image "$inputImage"
          --output_html "$output"
  </command>

  <inputs>
    <param format="txt" name="inputImage" type="data" label="Input Image" />
  </inputs>
  <outputs>
    <data format="html" name="output" label="${tool.name<http://tool.name>} on 
#echo os.path.basename( str ( $inputImage.name ) )#" />
  </outputs>
  <help>
Copy Tool

  </help>
</tool>

And copy.pl<http://copy.pl>:
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
my $input_image ;
my $output_html ;

# Get options from command line (i.e. galaxy)
my $result = GetOptions ( "input_image=s" => \$input_image,
                          "output_html=s" => \$output_html )
                          or die "Bad options";

print "input_image is: $input_image\n";

open FILE,"$input_image" or die $!;
my @lines = <FILE>;
close FILE;
my $numOfLines = scalar @lines;


# Create the output HTML, with links to the files and the square gif.
#
open HTML, ">", $output_html
        or die "Failed to create output HTML file '$output_html': $! ";

print HTML<<EOF;
<html>
<head>
<style>
iframe {
        border: 0px;
        background: #eeeeee ;
}
</style>
</head>
<body>
<h1>Copy Files tool</h1>
<h2>Generated $numOfLines files</h2>
EOF

# Put direct links to each output file
foreach my $sub_filename ( @lines )
{
  print HTML "Direct link to the $sub_filename file.<br/>\n";
}

print HTML "<br/><br/><br/>\n";

print HTML "</body></html>\n" ;

close HTML ;

So pretty basic.

I run:
./example_watch_folder.py cce1b01926646d548f6ddc32ff01aa2e 
http://140.253.78.234/galaxy/api/ /home/galaxy/data_input 
/home/galaxy/data_output "My API Import" f2db41e1fa331b3e

and get the following output:
{'outputs': ['a799d38679e985db'], 'history': '33b43b4e7093c91f'}

I can see the sample.txt file I placed in the /home/galaxy/data_input has been 
put into the database:
/home/galaxy/galaxy-dist/database/files/000/dataset_8.dat

and:
http://140.253.78.234/galaxy/api/libraries/f2db41e1fa331b3e/contents/1cd8e2f6b131e891
shows the file has been uploaded:

{

    "data_type": "txt",

    "date_uploaded": "2013-05-09T04:41:10.579602",

    "file_name": "/home/galaxy/galaxy-dist/database/files/000/dataset_8.dat",

    "file_size": 76,

    "genome_build": "?",

    "id": "1cd8e2f6b131e891",

    "ldda_id": "1cd8e2f6b131e891",

    "message": "",

    "metadata_data_lines": 8,

    "metadata_dbkey": "?",

    "misc_blurb": "8 lines",

    "misc_info": "uploaded txt file",

    "model_class": "LibraryDataset",

    "name": "sam2.txt",

    "template_data": {},

    "uploaded_by": "t...@test.com<mailto:t...@test.com>",

    "uuid": null

}



However, looking in the histories:

http://140.253.78.234/galaxy/api/histories/33b43b4e7093c91f/contents/a799d38679e985db






The output file is zero as the input file can not be found as shown below in 
bold ...



{

    "accessible": true,

    "api_type": "file",

    "data_type": "html",

    "deleted": false,

    "display_apps": [],

    "display_types": [],

    "download_url": 
"/galaxy/api/histories/33b43b4e7093c91f/contents/a799d38679e985db/display",

    "file_ext": "html",

    "file_name": "/home/galaxy/galaxy-dist/database/files/000/dataset_9.dat",

    "file_size": 0,

    "genome_build": "?",

    "hid": 1,

    "history_id": "33b43b4e7093c91f",

    "id": "a799d38679e985db",

    "metadata_data_lines": null,

    "metadata_dbkey": "?",

    "misc_blurb": "error",

    "misc_info": "Thu May  9 14:42:10 2013input_image is: None\nNo such file or 
directory at /home/galaxy/galaxy-dist/tools/copy/copy.pl<http://copy.pl> line 
27.\n",

    "model_class": "HistoryDatasetAssociation",

    "name": "Copy Tool on None",

    "peek": null,

    "purged": false,

    "state": "error",

    "uuid": null,

    "visible": true,

    "visualizations": []

}



Does anyone have any idea why the input_file is not passed in/obtained in the 
perl script?

as the script obviously copies it to the database so part of the script is 
working?



the file sam2.txt looks like this






Thanks again, sorry for swamping the list with this issue



Neil


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Reply via email to