Batch Error

0 views
Skip to first unread message

Oswald Lemus

unread,
Aug 3, 2024, 5:14:20 PM8/3/24
to menzipostels

So when my script fails:its prints Sync failed
but when my script(get_files.bat) success it prints:Sync failed
Sync successSo I dont know why its print both Sync failed & Sync success when my script(get_files.bat) passed successfully

You will need to align the bats, so that it is possible for the interaction of one to inform the result of the execution to the other bat, it is no use editing a goto :label/:eof only on the bat that calls the execution of the other, it will not return an accurate/precisely execution of the successful occurrence, one or more errors.

Your script is designed to take actions when returning 0 or returning non 0 for the execution of your other file batch, but understand that it doesn't work well for bat files, with call if !errorlevel! you will not get an accurate return the errorlevel to the same way that you get from an executable (or internal/external command), which also applies "in part", for some cmd.exe/executed in blocks (like dir file_1.txt file2.txt).

What you can do to give a precise status of the execution status, would be to send bat variables to the other batch, or at least some string in the output, thus replacing the errorlevel, but it requires an edition of your bat for one version more aligned with the execution to respond to the bat that originated the execution call, something that responds predictively to the error event or not.

Editing your bat to make use of a control over the results of your commands using operator (return non 0), where you can define your own errolevel based on the result of each "critical execution", also making use of the exit /b command with your errorlevel predefined, which will be captured by the calling bat and the relevant actions will be performed accurately.

The fix is to insert a harmless command that is guaranteed to succeed at the end of the success branch. I like to use (call ), which does nothing except set the ERRORLEVEL to 0. There is a corollary (call) that does nothing except set the ERRORLEVEL to 1.

Using ERRORLEVEL when it's available is the easiest option. However, if you're calling an external program to perform some task, and it doesn't return proper codes, you can pipe the output to 'find' and check the errorlevel from that.

The ability to easily use .Net assemblies and methods was one of the major reasons I started with PowerShell. The improved error handling was another. The fact that Microsoft is now requiring all of its server programs (Exchange, SQL Server etc) to be PowerShell drivable was pure icing on the cake.

Thank you for the reply. That is helpful. I adjusted the batch mode and close() lines in my script. Now Batch Mode will process all of the files within the selected folder. There are 3 issues that still need a little work.

I looked back at what is displayed in the Recorder window while setting threshold values. What is the difference between setAutoThreshold() and run("Threshold...", "Minimum")? Both seem to work in batch mode, but setAutoThreshold() seems to behave more predictably.

You seem to be doing pretty well with the macro scripting, I would look at using the script editor to do all of the work and not use the Process->Batch->Macro method, see this page for details. It gives an example of running a blank function through a whole folder. From there you can use your script (below) to only run through .tif files and avoid any other files.

I ran the workflow and received an error in macro. The data types have been changed in a select tool in the macro. I even manually checked the files to make sure the data types are correct in the input folder. the macro is working using the last month files but got the error using this month data. The files are in xsl format. Not sure if the issues with the new files and the folder. I have seen someone changed the setting to make macro compatibility with the main workflow before, but do not remember where to make the changes. Maybe there are other things I need to do to fix the issues. I appreciate if anyone could help.

Thanks for your prompt responses. As I mentioned in the post, I have used select tool to force the data type to the one I needed for certain columns. I have manually checked the input folders to make sure the columns are the correct data types. However I am still getting the same error. The message indicated the record #10 has an error, so I removed that file out of the folder and reran, then I got the same error indicating the error in record #9, if I remove the file again, it will show error record #8 . Where those files had no issues before.

@TheOC I figured it out. I changed one data type from V-String to V_Wstring Forced, and changed the setting in the interface designer. The error messages are gone. I think because the files are in xls format and each file has slightly different format with different data type, the macro needs to be updated accordingly.

in my case the underlying cause of this was that one of the tables had a BLOB column and it had huge content. you can either filter out that column (or table) from the dump, or you can increase the value of max_allowed_packet (default 4M) to something large like 500M.

This has got to be literally the most idiotic design choice I've encountered in a long while. There is absolutely no indication about the button's status if you're running in dark mode. Neither text nor color or shape. Not even a slight hue variation, or maybe a small message when the error pops up and it says I can try pushing that button. Zero indication whatsoever, just "press the button lol".Loved spending the last 20-30 mins trying to figure out why the freaking button didn't seem to be usable, deleting and recreating the database and choosing various combinations of settings, in case I was missing something. I was almost about to give up and import my SQL with another software.

I tried going to Interface Designer - Properties and changing to "Auto Configure by Name", but found that it was only running the macro for the first record in the control parameter and then stopping--so the output was just one iteration. I then tried stripping everything out to figure out what was going on. I changed the macro to literally just grab the column names from the table, and then drop every field other than Name. So the output should just be the column "Name" every time, but it still throws the same error, and if it's set to "Auto Configure by Name" then it still only runs one iteration and then stops. I have no idea what's causing the problem at this point, can anyone help?

In other words.... if one input batch contains the field Provider and the next batch does not contain that field, you'll get the error "changed between iterations". The error is mentioning "Output8", but the error is likely with your input data.

It's the same input table every time, and it has the fields AdjustmentType, Provider, System, Specialty, Notes, plus all of the Scenario columns. The control parameter is a list of the names of those Scenario columns. I just tried using "Output fields change based on macro's configuration or data input", and I'm getting the same issue where it does one iteration and then stops.

I have a Windows 10 Pro workstation that is completely up to date with an up to date version of Adobe Photoshop CC 2018 installed. When I attempt to run a batch through the automate menu, I receive this error: "Could not complete the Batch command because the file could not be found." No matter what action and folders I attempt to use, I receive this error. I did my best to search for others experiencing this problem, but could not find anything online with this exact error message.

My files were on a thumb drive, they are all jpg types. I wrote a Batch command to execute the Trim function (why doesn't Adobe provide a keystroke command for this function?). Wanted the batch to Save and Close.

I also had this issue with v.22.0.0, updated 10/20/2020. This solution worked for me by creating an "Errors" folder on the :C drive and listing it as the destination for "Log Errors to File" in the Batch dialog box. Thanks, sapsaj!

Instead of showing an error message, perhaps it would be more helpful for the prompt to read "Please select a destination folder for the error log." and to bring up a "choose a destination folder" window. This would help the user correct the cause of the error.

You cannot use relative KNIME-URLs when running a workflow in the batch executor. Only the workflows pass on the command line is available and therefore there is no mountpoint or similar available to resolve relative URLs.

How I made it work for me
In the end the only reliable manner or in some cases the only way to change the path for me was: Edit the settings.xml of the Call Local Workflow node with a text editor directly.

The interesting errors relevant to your return code 4 start after the INFO main BatchExecutor line. It appears to be saying that the workflow that was saved and is now attempting to be executed from command line has one or more nodes that need a configuration specifying a source which had either no value or an invalid value specified. It also is complaining about a flow variable not being populated - perhaps this would be flowing out of one of the nodes complaining about its location not being defined.

Are you running workflow on the same machine? If you are reading some data I suggest checking your paths. That can be an issue.
Some nodes do report that they created empty tables. Should that happen? KNIME log is a file you want to check for more information.

I was writing some code to gracefully handle a 409 Conflict when sending a batch create contact request. I originally assumed that "at least one" of the contacts in the batch must be conflicted and that if I parsed the error response, I could determine the email address causing the conflict, "remove" that item from the batch and retry the request. In this way I could "clean up" the request until it worked. What I found was that, in a batch of more than one contact where at least one was a conflict, but others were not, the "non-conflicted" item(s) DOES get created, even though the request itself returns a 409.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages