Problem with "Rename File" task - VisualCron - Forum

Community forum

PeterW
2008-10-27T13:21:52Z
I'm seeing some strange behavior with the rename file task. I have a job running every 10 minutes that downloads a pgp encrypted file from an FTP site, decrypts it, and renames it. This morning I was reviewing the logs from this past weekend and saw a bunch of errors regarding the rename file portion of the task. For example:

10/26/2008 6:20:41 PM Err Rename files failed with error: Cannot create a file when that file already exists.
10/26/2008 6:30:40 PM Err Rename files failed with error: Cannot create a file when that file already exists.
10/26/2008 6:50:40 PM Err Rename files failed with error: Cannot create a file when that file already exists.

There was not an error at 6:40 PM that same day. When I look in the archive folder I see a pgp file with a date/time stamp of 10/26/2008 6:40 PM so I believe I have the task set up correctly. Here are the file names:

send_accounts_{DATEFORMAT(yyyy_MM_dd)}.tsv.pgp
is being renamed to
send_accounts_{DATEFORMAT(yyyy_MM_dd_hhmmss)}.tsv.pgp

I have a file condition attached to the rename task that looks for the file "send_accounts_{DATEFORMAT(yyyy_MM_dd)}.tsv.pgp" and I see a match in the log. Here is the portion of the log for the job:

10/26/2008 6:50:30 PM Info Job started: Clockwork Results Import
10/26/2008 6:50:30 PM Info Task started: Get file from clockwork
10/26/2008 6:50:40 PM Info Task completed: Get file from clockwork
10/26/2008 6:50:40 PM Debug Running Condition Set: 'Clockwork "send" import file exists' for Task: Decrypt Clockwork file
10/26/2008 6:50:40 PM Debug File Condition (FileExist->MatchTrue) returned: Match
10/26/2008 6:50:40 PM Debug Condition Set (Task) returned: MatchAll-> ActionContinue
10/26/2008 6:50:40 PM Info Task started: Decrypt Clockwork file
10/26/2008 6:50:40 PM Info Task completed: Decrypt Clockwork file
10/26/2008 6:50:40 PM Debug Running Condition Set: 'Clockwork "send" import file exists' for Task: Rename PGP file
10/26/2008 6:50:40 PM Debug File Condition (FileExist->MatchTrue) returned: Match
10/26/2008 6:50:40 PM Debug Condition Set (Task) returned: MatchAll-> ActionContinue
10/26/2008 6:50:40 PM Info Task started: Rename PGP file
10/26/2008 6:50:40 PM Err Rename files failed with error: Cannot create a file when that file already exists.
10/26/2008 6:50:40 PM Info Task completed: Rename PGP file
10/26/2008 6:50:40 PM Info Job completed: Clockwork Results Import

Is it possible there is a file locking condition that is preventing VisualCron from renaming it? Since I am adding hours, minutes and seconds to the file name I never would have expected to see a "file already exists" message. This is confusing! Anyone have any suggestions or tips for me to try?

Thank you!

-Peter
Support
2008-10-28T11:23:08Z
It seems like you, according to your log, is performing the Rename Task if the Task already exist? Didn't you want to perform the Rename when it did not exist?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
PeterW
2008-10-28T14:40:42Z
No, I want to perform the rename when the file exists. Sorry I probably didn't make that clear in my original post.

Here is the condition for the file rename portion of the job:

If file "send_accounts_{DATEFORMAT(yyyy_MM_dd)}.tsv.pgp" exists then execute the rename file action which renames file "send_accounts_{DATEFORMAT(yyyy_MM_dd)}.tsv.pgp" to "send_accounts_{DATEFORMAT(yyyy_MM_dd_hhmmss)}.tsv.pgp". The interesting thing is it works most of the time however at night it failed again saying:

10/27/2008 9:00:53 PM Err Rename files failed with error: Cannot create a file when that file already exists.

I tried adding a 10 second wait task in between the decrypt pgp file task and rename file task however that did not solve the problem.

-Peter
Support
2008-10-28T15:25:00Z
It seems like there is a simple configuration error. Hard to say what. PGP Task does not end until it is finished so waiting after should not matter.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2008-10-28T15:26:06Z
One thing could be that you are using the File trigger with Change attribute. That will give multiple triggers. You should use the Created attribute.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
PeterW
2008-10-28T16:01:33Z
I am not using a file trigger to run the job or as part of the condition (Change or Created attribute). It is currently using a time trigger and is executing every 10 minutes between 6 AM and Midnight. Here is the layout of the job if this will help:

Task 1: Get file from external FTP site. There are no conditions attached to this task.
Task 2: Decrypt the pgp file that was downloaded. There is a condition attached to this task. It is a "file exists" condition. It will only execute if file
"send_accounts_{DATEFORMAT(yyyy_MM_dd)}.tsv.pgp" exists otherwise the job will exit.
Task 3: Wait 10 seconds.
Task 4: Rename the pgp file that was downloaded. I have the same condition set attached to this task that task 2 has.

The only conditions used in this job are the "file exists" condition so I am not using a Change or Created attribute. Could the problem be that I am renaming the file in the same folder? I was thinking of having the FTP task download the file to a seperate folder and then having the rename task put it in, say, an archive folder.
Support
2008-10-28T16:23:36Z
I was thinking that you never delete the file from the FTP and re-download it every 10 minutes. Then it will fail.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
PeterW
2008-10-28T16:40:46Z
Ahh! Okay, I understand what you are saying. I checked the FTP task and it does delete the source file after it is downloaded so that shouldn't be the problem.
Support
2008-10-28T16:44:43Z
I think you need to break it down to very simple. Disable Tasks to see which Task is actually the problem. Try disabling all Tasks but the rename task first and add a new file there.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
PeterW
2008-10-28T19:12:40Z
Thank you for your help! I figured out what the problem was.
altoner
2013-03-06T14:21:35Z
What was the solution you found?
Scroll to Top