Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No method named getRunModel() in Job.php even though it is called in getCallback() #295

Closed
djfordz opened this issue Aug 22, 2016 · 6 comments

Comments

@djfordz
Copy link

djfordz commented Aug 22, 2016

Hi,

You have a method that is being called in getCallback() in Job.php that tries to return $helper->getCallBack($this->getRunModel()); getRunModel() doesn't even exist in the program
screenshot from 2016-08-22 10-25-43
screenshot from 2016-08-22 10-25-58

. thus this is what we are getting on a customer store:

Cron error while executing xtento_orderexport_profile_1:

exception ‘Mage_Core_Exception’ with message ‘Invalid model/method definition, expecting "model/class::method".’ in /public_html/app/Mage.php:595 Stack trace:
#0 app/code/community/Aoe/Scheduler/Helper/Data.php(294): Mage::throwException('Invalid model/m…') #1app/code/community/Aoe/Scheduler/Model/Job.php(143): Aoe_Scheduler_Helper_Data->getCallBack('')
#2 /public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(180): Aoe_Scheduler_Model_Job->getCallback()

#3 public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(570): Aoe_Scheduler_Model_Schedule->runNow(true)
#4 /public_html/app/code/community/Aoe/Scheduler/Model/Observer.php(39): Aoe_Scheduler_Model_Schedule->process()
#5 public_html/app/code/local/Xtento/OrderExport/Model/Observer/Cron/Config.php(24): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#6 public_html/app/code/core/Mage/Core/Model/App.php(1338): Xtento_OrderExport_Model_Observer_Cron_Config->addCronjobsToConfig(Object(Varien_Event_Observer))

#7 public_html/app/code/core/Mage/Core/Model/App.php(1311): Mage_Core_Model_App->_callObserverMethod(Object(Xtento_OrderExport_Model_Observer_Cron_Config), ‘addCronjobsToCo…’, Object(Varien_Event_Observer))
#8 public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#9 /public_html/shell/scheduler.php(356): Mage::dispatchEvent('default', Array)
#10 /home/afsupply/public_html/shell/scheduler.php(21): Aoe_Scheduler_Shell_Scheduler->cronAction()
#11 public_html/shell/scheduler.php(382): Aoe_Scheduler_Shell_Scheduler->run() #12 {main}

@seansan
Copy link

seansan commented Dec 11, 2016

+1

Same issue here, would be great if solved

Thx! Love AOE Scheduler

@seansan
Copy link

seansan commented Dec 11, 2016

For now?

    if (method_exists($this, 'getRunModel')) {
		return $helper->getCallBack($this->getRunModel());
	} else {
		return false; // boolean?
	}

@fbrnc
Copy link
Member

fbrnc commented Dec 13, 2016

Hi,
the getRunModel() method actually doesn't exist and that's ok since it's a magic method. The problem here is that some Magento modules don't configure their cron jobs correctly by not configuring run_model. Without that Aoe_scheduler can't execute the job, so it's expected behavior that this isn't working.
This only happens with some selected cron jobs, right? Please try fixing their cron configuration.
Hope this helps.

Have a great day,
Fabrizio

@seansan
Copy link

seansan commented Dec 13, 2016

thanks I understand

however you must know sometimes we have limited influence on others ....

so a workaround, or at least the ability to stop receiving clogged error logs and emails about this would already be a lot of help

how about adding a quick check
of model exists, then continue
if not then skip and make 1 entry in log explaining what is wrong?

thx

@seansan
Copy link

seansan commented Feb 26, 2017

What would one have to add the extension? I dont see RunModel or run_model variables on other cron .... and am trying to fix but dont know how/where to add what ;P (any tips appreciated)

This is what makes it a little more complex in confix.xml - the way that the cron jobs are added

where would one add

        <events>
            <!-- This event is only dispatched for cron.php based executions. We can use it to add our own "dynamic" cronjobs to the config before the cron runs. Must be added in global area and not crontab area as only then it gets executed before "crontab default" event. -->
            <default>
                <observers>
                    <cron_observer_stock_import>
                        <type>model</type>
                        <class>module_stockimport/observer_cron_config</class>
                        <method>addCronjobsToConfig</method>
                    </cron_observer_stock_import>
                </observers>
            </default>
            <module_cronjob_dispatch_before>
                <observers>
                    <module_stockimport_module_cronjob_dispatch_before>
                        <type>model</type>
                        <class>module_stockimport/observer_cron_config</class>
                        <method>moduleCronjobDispatchBefore</method>
                    </module_stockimport_module_cronjob_dispatch_before>
                </observers>
            </module_cronjob_dispatch_before>
            <adminhtml_controller_action_predispatch_start>
                <observers>
                    <add_cronjobs_to_config_for_aoe_scheduler_stock_import>
                        <type>model</type>
                        <class>module_stockimport/observer_cron_config</class>
                        <method>addCronjobsToConfigAoeScheduler</method>
                    </add_cronjobs_to_config_for_aoe_scheduler_stock_import>
                </observers>
            </adminhtml_controller_action_predispatch_start>
        </events>
    </global>
    <crontab>
        <events>
            <default>
                <observers>
                    <cron_observer_stock_import>
                        <type>model</type>
                        <class>module_stockimport/observer_cron_config</class>
                        <method>addCronjobsToConfig</method>
                    </cron_observer_stock_import>
                </observers>
            </default>
            <module_cronjob_dispatch_before>
                <observers>
                    <module_stockimport_module_cronjob_dispatch_before>
                        <type>model</type>
                        <class>module_stockimport/observer_cron_config</class>
                        <method>moduleCronjobDispatchBefore</method>
                    </module_stockimport_module_cronjob_dispatch_before>
                </observers>
            </module_cronjob_dispatch_before>
        </events>
    </crontab>

@djfordz
Copy link
Author

djfordz commented Mar 16, 2017

@fbrnc Thanks for the resolution. Seems to be extension devs that need to get on the ball. should have thought about it being a magic method. Again, thank you for the explanation.

@djfordz djfordz closed this as completed Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants