ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 2 replies, has 2 voices, and was last updated by  shreyas 10 months, 4 weeks ago.

  • Creator
    Topic
  • #24710

    shreyas
    Participant

    Hi Team,

    I have written a Custom Command Class that contains tasks that has to be executed(DB related tasks) for certain amount of time that would be given in getDefaultDefinition(). Now when i set the cron, it behaves unexpected . At some times it Runs perfectly as expected But every alternative or so i get some wierd error as given below in screenshot:

    Error in Cron Command Execution

    And Sometimes it works perfectly fine as in given below screenshot:

    Cron Job for Command Successfully Run

    The alternative Passes & fail of Cron Command Summary is given in below Screenshot:
    Passes/Fail states of Command

    The Common error we get here for Fail state(As shown in screenshot above is) as: [InvalidArgumentException]
    Command “oro:cron:taskdelayevent-email” is not defined
    .

    I even thought is it due to some tasks written in execute() that is causing some exception & command fails but that is not the issue since when i run this manually in app/console it perfectly works as expected.

    i.e: Cron Command Success on Manual Run

    When i run this command any time manually as shown above , i do not get any exception.So i guess it is not from code written in this Execute() function. I am stuck on how to get over with this issue as it is necessary to be working as Automated & i cannot manually enter the command & run every now & then. i have followed similar way as other code i had written which is perfectly working fine without any issues except some logic changes in Execute() function & use of Repository here.

    Please find the code snippet of Code used in Custom Bundle (CustomTaskBundle/Command) :

    Pleas need help in how to solve this issue so that cron command would run correctly at regular interval of time specified in getDefaultDefinition() function.

    Thanks & Regards,
    Shreyas S

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #24839
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    Maybe this topics can help you. First and second.
    I suggest you remove part of code and see errors disappear or not, if not – try again. You can start from getRepository, try to remove it from getDefaultDefinition(). Also look at app/logs, maybe you will find there some interesting information.

    #24887

    shreyas
    Participant

    Hi Mike,
    Thanks a lot for Suggestion. I tried removing part of code which had DB activities (i.e removed getRepository & also DB code present in getDefaultDefinition(). And kept only a single statement inside execute() function i.e: $output->writeln(“Execution Started”);. It gave the same error. There was some problem in my instance’s Database i think since when i used my instance code connect to different copy of Database with same tables & entities configuration by changing Database name in parameters.yml it worked perfectly fine without any issues.So i think my Database Tables had some issue now it is working fine after changing the Database.

    Thanks,
    Shreyas S

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.