I have an iwat trigger set up for CreateFSE. I'm using it on a certain branch to run a Java class that sets certain EAs when a file is imported. I know the iwat is triggering fine because, well, it works. But only with smaller files.It seems like the problem is that the local file manager applet creates a dummy placeholder file or something as the file is being uploaded by the import functionality, which it renames to be the "real" file once the import is done. I can get around the naming issue because it seems like the naming is done consistently, like if I am importing:/TeamSite-1/main/branch/SupportingFiles/WORKAREA/content/documents/ibatis.pdfthe file is first created as /TeamSite-1/main/branch/SupportingFiles/WORKAREA/content/zz_lfm_documents_ibatis.pdfYou can check this viewing the file path sent by the trigger when the CreateFSE event happens as a result of an import.With a smaller file, this is no big deal because it uploads quickly enough where this initial file creation and renaming happens so fast it doesn't impact anything.But with a larger file, the trigger runs the class before the file is done importing (because the initial file ""zz_lfm_..." is created), so the "real" file doesn't exist yet even as the class that was triggered by the CreateFSE event is finished running.Anyone have any experience with the situation with which I am dealing?
I haven't dealt with this specific problem - but you seem to have identified the situation without coming up with the (IMO) natural fix: have your script loop until the zz_* file is gone / the expected file exists.Or did you try this and it didn't work?
What I did was ended up adding a trigger based on the 'Lock' event, which the LFM does at the end of its import action and then added logic based on the default comment which the file import always adds. A semi-kludge, but c'est la vie. Good enough sometimes has to be the best.Thanks again for your response.
...my $count = 0;while (! -f $filename && -M $filename > 0.1) { # log delay? sleep 1; $count++; if ($count > $MAX_TRIES) { # prevent endless loop # log abort die "$0: Exceeded $MAX_TRIES"; }}...
I have an iwat trigger set up for CreateFSE. I'm using it on a certain branch to run a Java class that sets certain EAs when a file is imported. I know the iwat is triggering fine because, well, it works. But only with smaller files.
Solution: ModifyFSE logs an event whenever a file is modified for the first time after a submit. There is no event for each time a file is modified. The reason for this is that you'll end up with too many events for modifications through the y drive, since each file save generates multiple writes.
I wanted to do something similar using iwatcreate. When my CreateFSE events were not being logged I contacted support and they said,Is there a chance that you are submitting these files which may take longer for larger files?
Another possibility would be something like this (untested code):...my $count = 0;while (! -f $filename && -M $filename > 0.1) { # log delay? sleep 1; $count++; if ($count > $MAX_TRIES) { # prevent endless loop # log abort die "$0: Exceeded $MAX_TRIES"; }}...The idea is to loop until you see the expected file in place AND that it's modification time is less than 0.1 days (2.4 hours) old (feel free to change that to something even less). You could also verify that the file has size > 0 though I suppose someone might want to import a zero-length file for some reason?It's still a bit kludgy, but probably a bit more efficient than checking for the comment...
The lock approach was indeed inefficient. After going back to the drawing table, I took a hybrid approach based on what I was doing and some of your suggestions. Here's an overview1) Wait until zz_lfm_* temp file DOES NOT exist. This needs to be done so that when I convert the silly zz_lfm_* path into a real path in step 2, I know for sure that the file is done uploading/importing, and I can trust logic checking for its existence.2) Parse zz_lfm_* temp file to obtain path of real file (trickier than you might think). This involves removing the "zz_lfm_" from the path and then converting the prepended directories on the original filename (dir1_dir2_*) to be actual directories in a path (dir1/dir2). So if I imported a file "e_f_g" into the "d" directory in the path "a/b/c/d", the real path I get from the trigger is "zz_lfm_a_b_c_d_e_f_g" and I convert to the real path of a/b/c/d/e_f_g.3) Finally do the stuff I need to do to the actual imported file.
None of the above. And technically nothing gets passed into ARGV because I'm using Java. This is what gets passed as args if I import the file "test_file.pdf" to the path "\TeamSite-1\main\branchname1\subbranch\WORKAREA\content\documents\craptastic"- Timestamp like: [Wed May 06 09:47:02 2009]- User like: DOMAIN\id- Role like: master- Event like: CreateFSE- VPath to WA like: \TeamSite-1\main\branchname1\subbranch\WORKAREA\content- path to file in workarea like: \zz_lfm_documents_craptastic_test_file.pdfThe key is the last one, the "area relative path". If you look at it, you'll notice it's NOT simply weird because of the zz_lfm_ -- it's weird because "documents_craptastic_" is not actually part of the filename, but rather the directory path in which the file is being imported. Obviously this doesn't happen if you just create a new file in a workarea -- only if you're importing a new file. I don't know why the Local File Manager applet interacts with TeamSite like that, and it's definitely not how I as an armchair programmer would have done it.This sort of prepending of the directory path to the filename is what creates the problem because it makes it tough to determine the real filename, especially if the filename has underscores in it.Fortunately, the solution I posted yesterday is working well.
Just for giggles - create a small perl trigger script that just dumps out the ARGV contents - enable it for CreateFSE and see if it returns the same thing (I'm curious about the temporary filename being provided instead of the target filename).