Automic Workload Automation

 View Only
  • 1.  Error Handling in jobs

    Posted Aug 01, 2019 10:38 AM
    Edited by shani kushwaha Aug 01, 2019 10:39 AM

    Hi All,

    we are running few .NET jobs through Automic. These .NET jobs do not return any exit code and that's why we are using error handling as provided in Automic with below statements.

    @IF EXIST "JobSuccessful.flag" (
    @del "JobSuccessful.flag"
    )

    D:\Jobs\TrueValue\bin\DebugJobHost.exe TvVertexJob.config
    @set retcode=%errorlevel%
    @ECHO Job retcode=%retcode%

    @IF EXIST "JobSuccessful.flag" (
    @ECHO Success Flag found, setting retcode=0
    @set retcode=0
    ) ELSE (
    @ECHO Success Flag NOT found, setting retcode=1
    @set retcode=1
    )
    @if NOT retcode == 0 goto :retcode

    now even if the job fails from .NET end, it is ENDED_OK on Automic. when we check the logs , We can see the error in the output

    Output Job A:.
    [375] [1] INFO TrueValue.Jobs.TrueValue.TvVertexJob.TaxTableTransaction - Getting the DB2 Tax Table Transactions in Host Location: PROD_DB2Region
    [375] [1] DEBUG TrueValue.Jobs.TrueValue.TvVertexJob.GetEmbeddedResources - reading embedded resource: getTaxTableRecords.sql
    [41937] [1] FATAL TrueValue.Jobs.TrueValue.TvVertexJob.TaxTableTransaction - getTaxTableTransactions:Error=ERROR [57014] [IBM][DB2] SQL0952N Processing was cancelled due to an interrupt.
    [41984] [1] INFO TrueValue.Jobs.TrueValue.TvVertexJob.TvVertexJob - Job ending. Total Time:JobStarted - 00:00:41.6093750
    JobStarted - 00:00:41.6093750
    [41984] [1] DEBUG TrueValue.Fry.Jobs.Host.Program - Finished Job TvVertexJob
    Process terminating normally, creating success flag file.
    Process Terminating: 0
    Job retcode=0
    Success Flag found, setting retcode=0

    Output Job B:

    [13140] [1] ERROR TrueValue.Jobs.TrueValue.OnlineRetailerOrderSubmitJob.OnlineRetailerOrderSubmitJob - an error occurred in UpdateOrderStatuses
    System.FormatException: Input string was not in a correct format.
    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
    at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
    at System.Convert.ToInt64(String value)
    at TrueValue.Jobs.TrueValue.OnlineRetailerOrderSubmitJob.OnlineRetailerOrderSubmitJob.<>c.<UpdateOrderStatuses>b__20_0(OrderStatus o)
    at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    at TrueValue.Jobs.TrueValue.OnlineRetailerOrderSubmitJob.OnlineRetailerOrderSubmitJob.UpdateOrderStatuses(String lastRunTime)
    [13468] [1] ERROR TrueValue.Jobs.TrueValue.OnlineRetailerOrderSubmitJob.OnlineRetailerOrderSubmitJob - an error occurred in OnlineRetailerOrderSubmitJob JobMain Method
    System.FormatException: Input string was not in a correct format.
    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
    at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
    at System.Convert.ToInt64(String value)
    at TrueValue.Jobs.TrueValue.OnlineRetailerOrderSubmitJob.OnlineRetailerOrderSubmitJob.<>c.<UpdateOrderStatuses>b__20_0(OrderStatus o)
    at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    at TrueValue.Jobs.TrueValue.OnlineRetailerOrderSubmitJob.OnlineRetailerOrderSubmitJob.UpdateOrderStatuses(String lastRunTime)
    at TrueValue.Jobs.TrueValue.OnlineRetailerOrderSubmitJob.OnlineRetailerOrderSubmitJob.JobMain(IJobContext jobContext)
    [13468] [1] DEBUG TrueValue.Fry.Jobs.Host.Program - Finished Job OnlineRetailerOrderSubmitJob
    Process terminating normally, creating success flag file.
    Process Terminating: 0
    Job retcode=0
    Success Flag found, setting retcode=0

    We can achieve some level of exception using FILTER object however my concern is what if the error changes in upcoming executions.
    So, FILTER object is our last resort. before that could someone please suggest what is wrong here and how we can capture the error without using FILTER Object.


    Thanks in Advance
    Shani



  • 2.  RE: Error Handling in jobs

    Posted Aug 02, 2019 03:50 AM
    Hi,

    I think you need to talk to the developer of DebugJobHost.exe and ask him to adjust the error handling in the program (see Best practices for exceptions). Google didn't give me any results about the program. I guess it is a proprietary development?

    Otherwise, I only think of the use of FILTER objects. However, I can also understand your concerns.

    Best regards
    Tim

    ------------------------------
    Automation Evangelist
    Fiducia & GAD IT AG
    ---
    Mitglied des deutschsprachigen Automic-Anwendervereins FOKUS e.V.
    Member of the German speaking Automic user association FOKUS e.V.
    ------------------------------



  • 3.  RE: Error Handling in jobs

    Posted Aug 02, 2019 06:54 AM
    Hi Tim,

    I am not the owner of the program, let me check with the developers on this. however they are reluctant in doing any changes from their end.

    Thanks
    Shani