/**
  * @param string $jobCode
  * @return array
  */
 protected function getJobConfig($jobCode)
 {
     foreach ($this->_cronConfig->getJobs() as $jobGroup) {
         foreach ($jobGroup as $job) {
             if ($job['name'] == $jobCode) {
                 return $job;
             }
         }
     }
     return [];
 }
 /**
  * Generate cron schedule
  *
  * @param string $groupId
  * @return $this
  */
 protected function _generate($groupId)
 {
     /**
      * check if schedule generation is needed
      */
     $lastRun = (int) $this->_cache->load(self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT . $groupId);
     $rawSchedulePeriod = (int) $this->_scopeConfig->getValue('system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_GENERATE_EVERY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     $schedulePeriod = $rawSchedulePeriod * self::SECONDS_IN_MINUTE;
     if ($lastRun > $this->timezone->scopeTimeStamp() - $schedulePeriod) {
         return $this;
     }
     $schedules = $this->_getPendingSchedules();
     $exists = [];
     /** @var Schedule $schedule */
     foreach ($schedules as $schedule) {
         $exists[$schedule->getJobCode() . '/' . $schedule->getScheduledAt()] = 1;
     }
     /**
      * generate global crontab jobs
      */
     $jobs = $this->_config->getJobs();
     $this->_generateJobs($jobs[$groupId], $exists, $groupId);
     /**
      * save time schedules generation was ran with no expiration
      */
     $this->_cache->save($this->timezone->scopeTimeStamp(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT . $groupId, ['crontab'], null);
     return $this;
 }