I am trying to debug a failed task in craft. However I'm not really sure what I'm looking for. I've dug though the log files and found traces of the task but no real errors to speak of. I have set:
'runTasksAutomatically' => false,
in my general.php file so that when I create my task:
craft()->tasks->createTask('WassermanNews_SocialTask');
craft()->end();
it will become a pending task rather than run automatically. That part seems to work as I end up with a pending task in my control panel.
So I think I've got the process up to this point. From here I'd simply like to kick off that pending process which I am attempting to do by though cURL.
curl -H "X-Requested-With: XMLHttpRequest" myurl.dev:32769/actions/tasks/runPendingTasks
I know that this is firing because the tasks moves from a pending state to a failed state:
However as I previously mentioned I have no idea why the task is failing and the logs do not seem to be my friend today.
Any ideas on what I could be doing wrong/where I could look for errors?
Below is my task which should be firing (it fires 1 subTask):
<?php
namespace Craft;
class WassermanNews_SocialTask extends BaseTask
{
$TWITTER = 1;
$INSTAGRAM = 2;
$VINE = 3;
public function getDescription()
{
return 'Social Grab';
}
public function getTotalSteps()
{
return 3;
}
public function runStep($step)
{
WassermanNewsPlugin::log("Social Grab stepz izz happening",LogLevel::Info);
switch($step){
case TWITTER:
return $this->runSubTask('WassermanNews_TwitterTask');
case INSTAGRAM;
return $this->runSubTask('WassermanNews_InstagramTask');
case VINE:
return $this->runSubTask('WassermanNews_VineTask');
}
}
}
All the sub tasks look more or less identical to this:
<?php
namespace Craft;
class WassermanNews_TwitterTask extends BaseTask
{
public function getDescription()
{
return 'Twitter Task';
}
public function getTotalSteps()
{
return 1;
}
public function runStep($step)
{
return "twitter step";
}
}
Any help figuring this out would be much appreciated!
UPDATE:
I just attempted to run the an example and it failed as well. Do certain settings affect how tasks are run?
Installed PixelAndTonic's Power Nap and it failed as well! I did however find a log for this example saying:
Encountered an error running task 95 (PowerNap): Could not find the task component type.
This makes me wonder what the type of the task has to be! I took a look in TasksService.php and saw that the error is derived from not having a type so what type do tasks need to have?
craft/storage/runtime/logs
are you not getting any task related error message?