Get attributes for div representing a gantt element

@param Aoe_Scheduler_Model_Schedule $schedule
@return string
973465
public function getGanttDivAttributes(Aoe_Scheduler_Model_Schedule $schedule)
    {

        if ($schedule->getStatus() == Aoe_Scheduler_Model_Schedule::STATUS_RUNNING) {
            $duration = time() - strtotime($schedule->getStarttime());
        } else {
            $duration = $schedule->getDuration() ? $schedule->getDuration() : 0;
        }
        $duration = $duration / $this->zoom;
        $duration = ceil($duration / 4) * 4 - 1; // round to numbers dividable by 4, then remove 1 px border
        $duration = max($duration, 3);

        $offset = (strtotime($schedule->getStarttime()) - $this->starttime) / $this->zoom;

        if ($offset < 0) { // cut bar
            $duration += $offset;
            $offset = 0;
        }

        $result = sprintf(
            '<div class="task %s" id="id_%s" style="width: %spx; left: %spx;" ></div>',
            $schedule->getStatus(),
            $schedule->getScheduleId(),
            $duration,
            $offset
        );

        if ($schedule->getStatus() == Aoe_Scheduler_Model_Schedule::STATUS_RUNNING) {
            $offset += $duration;

            $duration = strtotime($schedule->getEta()) - time();
            $duration = $duration / $this->zoom;

            $result = sprintf(
                '<div class="estimation" style="width: %spx; left: %spx;" ></div>',
                $duration,
                $offset
            ) . $result;
        }

        return $result;
    }
712834
def get_verba_link_for_schedule(self, schedule):
        
        dao = Book_DAO()

        url = self.get_verba_url(schedule)

        response = dao.getURL(url, {"Accept": "application/json"})
        if response.status != 200:
            raise DataFailureException(url, response.status, response.data)

        data = json.loads(response.data)

        for key in data:
            if re.match(r'^[A-Z]{2}[0-9]{5}$', key):
                return "%s%s&quarter=%s" % (BOOK_PREFIX,
                                            key,
                                            schedule.term.quarter)
136849
def get(self, flex_sched_rule_id):
        """"""
        path = '/'.join(['flexschedulerule', flex_sched_rule_id])
        return self.rachio.get(path)
746181
public function getNewEmptyItem()
    {
        $model = Mage::getModel($this->model);

        if (!$model instanceof Aoe_Scheduler_Model_Job) {
            Mage::throwException(
                sprintf(
                    'Invalid model class. Expected "%s" and received "%s".',
                    'Aoe_Scheduler_Model_Job',
                    (is_object($model) ? get_class($model) : 'UNKNOWN')
                )
            );
        }

        return $model;
    }
818189
def get_scheduling_block_ids():
    """"""
    ids = [key.split('/')[-1]
           for key in DB.keys(pattern='scheduling_block/*')]
    return sorted(ids)
640256
public function getJob()
    {
        if (is_null($this->job)) {
            $this->job = Mage::getModel('aoe_scheduler/job')->load($this->getJobCode());
        }
        return $this->job;
    }
1062441
public function getScheduleStatus()
    {
        if (!$this->scheduleStatus) {
            return false;
        } else {
            list($scheduleStatus) = explode(';', $this->scheduleStatus);

            return $scheduleStatus;
        }
    }
392945
public function show(string $schedule, array $params = [])
    {
        $path = $this->buildSchedulesPath($schedule);

        return $this->get($path, $params);
    }
799672
protected function defineScriptSchedule(Schedule $schedule, array $definition)
    {
        $arguments = $definition['arguments'] ?? [];

        $event = $schedule->exec($definition['script'], $arguments);

        $this->configureEvent($event, $definition);
    }
734163
public function showIndex()
    {
        $schedule = Schedule::orderBy('created_at')->get();

        return View::make('dashboard.maintenance.index')
            ->withPageTitle(trans('dashboard.schedule.schedule').' - '.trans('dashboard.dashboard'))
            ->withSchedule($schedule);
    }
543054
public function showEditSchedule(Schedule $schedule)
    {
        $incidentTemplates = IncidentTemplate::all();

        return View::make('dashboard.maintenance.edit')
            ->withPageTitle(trans('dashboard.schedule.edit.title').' - '.trans('dashboard.dashboard'))
            ->withIncidentTemplates($incidentTemplates)
            ->withSchedule($schedule);
    }
1279066
public function update(string $schedule, array $params = [])
    {
        $path = $this->buildSchedulesPath($schedule);

        return $this->put($path, $params);
    }
64171
def schedule(options)
      raise "Couldn't parse start time from attributes" if options[:at].nil?
      raise "Couldn't parse interval from attributes" unless options[:every].nil? || options[:every].is_a?(AS::Duration)

      at_ltz = Time.parse(options[:at]) || Time.now
      at_utc = Time.utc(*at_ltz) || Date.today.to_time.utc

      @metadata[:schedule] = {
        at:    at_utc,
        every: options[:every]
      }
    end
976805
public function getSitesIdWithAtLeastViewAccess($_restrictSitesToLogin = false)
    {
        /** @var Scheduler $scheduler */
        $scheduler = StaticContainer::getContainer()->get('Piwik\Scheduler\Scheduler');

        if (Piwik::hasUserSuperUserAccess() && !$scheduler->isRunningTask()) {
            return Access::getInstance()->getSitesIdWithAtLeastViewAccess();
        }

        if (!empty($_restrictSitesToLogin)
            // Only Super User or logged in user can see viewable sites for a specific login,
            // but during scheduled task execution, we sometimes want to restrict sites to
            // a different login than the superuser.
            && (Piwik::hasUserSuperUserAccessOrIsTheUser($_restrictSitesToLogin)
                || $scheduler->isRunningTask())
        ) {

            if (Piwik::hasTheUserSuperUserAccess($_restrictSitesToLogin)) {
                return Access::getInstance()->getSitesIdWithAtLeastViewAccess();
            }

            $accessRaw = Access::getInstance()->getRawSitesWithSomeViewAccess($_restrictSitesToLogin);
            $sitesId   = array();

            foreach ($accessRaw as $access) {
                $sitesId[] = $access['idsite'];
            }

            return $sitesId;
        } else {
            return Access::getInstance()->getSitesIdWithAtLeastViewAccess();
        }
    }
853242
def get_scheduler_info():
    """"""

    scheduler = current_app.apscheduler

    d = OrderedDict([
        ('current_host', scheduler.host_name),
        ('allowed_hosts', scheduler.allowed_hosts),
        ('running', scheduler.running)
    ])

    return jsonify(d)
814160
public function getShedule(string $day = 'all'): array
    {
        $parts = ['/'];
        if ($day !== 'all') {
            $parts[] = sprintf('div[contains(@class, "js-seasonal-anime-list-key-%s")]', $day);
        }
        $parts[] = 'div[contains(@class, "seasonal-anime")]';
        $query = implode('/', $parts);

        return $this->crawler->filterXPath($query)->each(
            function (Crawler $c) {
                return (new AnimeCardParser($c))->getModel();
            }
        );
    }
1294897
public function schedule()
    {
        $createdAtTime = $this->getCronTimestamp();
        $scheduledAtTime = $createdAtTime;

        /* @var $schedule Schedule */
        $schedule = $this->scheduleCollection->getNewEmptyItem();
        $schedule->setJobCode(Export::JOB_CODE)
            ->setStatus(Schedule::STATUS_PENDING)
            ->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', $createdAtTime))
            ->setScheduledAt(strftime('%Y-%m-%d %H:%M', $scheduledAtTime));

        $schedule->save();

        return $schedule;
    }