-
Notifications
You must be signed in to change notification settings - Fork 38
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
Jobs are queued without method name #100
Comments
Hello @mmucklo please look into this matter asap. I am unable to get why and how this happened. These details are under All jobs tab and my waiting list is empty right now. |
@Siba94 now im using this proyect for somethings in my work, can you show us the Worker file and the way about you are calling the job?! maybe i can help you |
Hello @rrcfesc |
Hi @Siba94 the code: $this->container->get("queue_name")->later(delay_seconds)->methodName(arguments); are you calling from some Controller? |
Version of Symfony?? |
Hi @rrcfesc Yes, I use that code in a controller as well as in services. symfony version 3.4. |
@Siba94 , im trying to reproduce that, i have a diferent aproach, but, you can send me the service.yml and how is defined, i have a example how im implement <?php
/**
* @author Ricardo Ruiz <[email protected]>
*/
namespace App\Worker;
use Dtc\QueueBundle\Model\Worker;
use MedCore\MedConnector;
use App\Interfaces\CronInterface;
use Psr\Log\LoggerInterface;
/**
* Class ExternalTranscriptExpiring
* Used to generate each company
* @package App\Worker
* @author Ricardo Ruiz Cruz <[email protected]>
* @version 0.9
*/
class ExternalTranscriptExpiring extends Worker implements CronInterface
{
/**
* Adding each company to the JobQueue for the
* @param string $executeDay Day of execution
* @throws \MedCore\Exception\ApiException
* @throws \MedCore\Exception\CurlException
* @throws \MedCore\Exception\SdkException
* @throws \Exception
*
*/
public function generate($executeDay = '') :void
{
echo "asd";
$start = microtime(true);
$dateTime = new \DateTime("NOW");
try {
if (strlen(trim($executeDay)) === 0) {
$executeDay = "NOW";
}
$dateTime = new \DateTime($executeDay);
} catch (\Exception $e) {
throw new \Exception("No Date configurated");
}
$cron = $this->medConector->CronJob->post([
'description' => 'Master Cron '.$this->resourceName,
"notification"=> 1,
"company"=> null,
"status"=> "progress"
]);
//$i = 1;
$this->logger->notice("Generating External Transcript Expiring");
//do {
$data = $this->medConector->Company()->page(350, array('items'=>5));
$items = $data['hydra:member'];
foreach ($items as $item) {
$this->logger->debug("Adding the next company", $item);
$this->later(0, 255)->executeCronCompany($item['id'], $dateTime);
}
// $i++;
//} while(count($items) >0);
$timeElapsedSecs = microtime(true) - $start;
$this->medConector->CronJob($cron['id'])->put([
'description' => $cron['description']." Time executed: ".$timeElapsedSecs,
'status' => 'success',
]);
$this->logger->notice("Time generated");
}
/**
* Generating the company process independing of the cron, or the date
* @param integer $companyId
* @param \DateTime $dateTime
* @throws \MedCore\Exception\ApiException
* @throws \MedCore\Exception\CurlException
*/
public function executeCronCompany($companyId, \DateTime $dateTime) : void
{
//echo $companyId."\n";
$start = microtime(true);
$cron = $this->medConector->CronJob->post([
'description' => $this->resourceName." execute Company".$companyId,
"notification"=> 1,
"company"=> null,
"status"=> "progress"
]);
$this->logger->debug("CronData".print_r($cron, true));
$timeElapsedSecs = microtime(true) - $start;
$this->medConector->CronJob($cron['id'])->put([
'description' => $cron['description']." Time executed: ".$timeElapsedSecs,
'status' => 'success',
]);
}
/**
* {@inheritdoc}
* @return string
*/
public function getName() :string
{
return "ExternalTranscriptExpiring";
}
}
`` |
Hi @rrcfesc, getting that issue often. Now It is working fine but still, I don't understand how the jobs are queued without a method name. Is it possible? and I have some questions, please help to get through this. Why do we need pruning for regular jobs? Why stalled feature is there and how it will help? As per documentation, it is there to show how to use but did not cover why do we need that. Any kind of help will be appreciated. |
@Siba94 sorry for the delay - my hands have been tied for months now - are you still having this issue? |
@mmucklo yes, sometimes and also there are jobs with status running in my all jobs section but nothing happened to them for a long time. Can you help me with this? I have a large number of running jobs for a long time. Do not understand why this type of problem occurred. |
@Siba94 I feel bad - I just saw your response now - if a job is killed or dies in the middle (OOM error, or Segfault, uncaught exception, power reboot, etc.) the job will be stuck in running. The Running status gets set as soon as the job starts. When a job is finished (without causing a segfault / etc.) the status is supposed to get set to Finished or Error. If you just want a one-time reset to restart all jobs that are stalled in running, then you can try the reset command. https://github.com/mmucklo/DtcQueueBundle/blob/master/Command/ResetCommand.php Otherwise if you just want to remove them from the database, you'll want to periodically use the prune command (as detailed in the README.md). |
Hello,
While my jobs are pushed into the queue, it goes along with null value. Please look into the following snapshot for better understanding.
![selection_002](https://user-images.githubusercontent.com/12645991/51300539-4f349f80-1a52-11e9-9dc4-fe1da35a7157.png)
![selection_003](https://user-images.githubusercontent.com/12645991/51300594-7e4b1100-1a52-11e9-86a2-3335d3ce1bf0.png)
![selection_004](https://user-images.githubusercontent.com/12645991/51300599-81de9800-1a52-11e9-91c8-3e73deb44f48.png)
The text was updated successfully, but these errors were encountered: