Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/scheduler/scheduler.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1310 Lines • ▼ Show 20 Line(s) | 1291 | { | |||
---|---|---|---|---|---|
1311 | 1311 | | |||
1312 | /* Then enumerate SchedulerJobs to consolidate imaging time */ | 1312 | /* Then enumerate SchedulerJobs to consolidate imaging time */ | ||
1313 | foreach (SchedulerJob *job, sortedJobs) | 1313 | foreach (SchedulerJob *job, sortedJobs) | ||
1314 | { | 1314 | { | ||
1315 | /* Let aborted jobs be rescheduled later instead of forgetting them */ | 1315 | /* Let aborted jobs be rescheduled later instead of forgetting them */ | ||
1316 | switch (job->getState()) | 1316 | switch (job->getState()) | ||
1317 | { | 1317 | { | ||
1318 | case SchedulerJob::JOB_SCHEDULED: | 1318 | case SchedulerJob::JOB_SCHEDULED: | ||
1319 | /* If job is scheduled, bypass if set to start later with a fixed time */ | 1319 | /* If job is scheduled, keep it for evaluation against others */ | ||
1320 | if (SchedulerJob::START_AT == job->getFileStartupCondition()) | | |||
1321 | if (now < job->getStartupTime()) | | |||
1322 | continue; | | |||
1323 | break; | 1320 | break; | ||
1324 | 1321 | | |||
1325 | case SchedulerJob::JOB_ERROR: | 1322 | case SchedulerJob::JOB_ERROR: | ||
1326 | case SchedulerJob::JOB_INVALID: | 1323 | case SchedulerJob::JOB_INVALID: | ||
1327 | case SchedulerJob::JOB_COMPLETE: | 1324 | case SchedulerJob::JOB_COMPLETE: | ||
1328 | /* If job is in error, invalid or complete, bypass evaluation */ | 1325 | /* If job is in error, invalid or complete, bypass evaluation */ | ||
1329 | continue; | 1326 | continue; | ||
1330 | 1327 | | |||
▲ Show 20 Lines • Show All 223 Lines • ▼ Show 20 Line(s) | 1550 | { | |||
1554 | currentJob->setState(SchedulerJob::JOB_INVALID); | 1551 | currentJob->setState(SchedulerJob::JOB_INVALID); | ||
1555 | 1552 | | |||
1556 | appendLogText(i18n("Warning: job '%1' has a fixed start time incompatible with its Moon separation restriction, marking invalid.", | 1553 | appendLogText(i18n("Warning: job '%1' has a fixed start time incompatible with its Moon separation restriction, marking invalid.", | ||
1557 | currentJob->getName())); | 1554 | currentJob->getName())); | ||
1558 | 1555 | | |||
1559 | break; | 1556 | break; | ||
1560 | } | 1557 | } | ||
1561 | 1558 | | |||
1559 | // Check whether a previous job overlaps the current job | ||||
1560 | if (nullptr != previousJob && previousJob->getCompletionTime().isValid()) | ||||
1561 | { | ||||
1562 | // Calculate time we should be at after finishing the previous job | ||||
1563 | QDateTime const previousCompletionTime = previousJob->getCompletionTime().addSecs(static_cast <int> (ceil(Options::leadTime()*60.0))); | ||||
1564 | | ||||
1565 | // Make this job invalid if startup time is not achievable because a START_AT job is non-movable | ||||
1566 | if (currentJob->getStartupTime() < previousCompletionTime) | ||||
1567 | { | ||||
1568 | currentJob->setState(SchedulerJob::JOB_INVALID); | ||||
1569 | | ||||
1570 | appendLogText(i18n("Warning: job '%1' has fixed startup time %2 unachievable due to the completion time of its previous sibling, marking invalid.", | ||||
1571 | currentJob->getName(), currentJob->getStartupTime().toString(currentJob->getDateTimeDisplayFormat()))); | ||||
1572 | | ||||
1573 | break; | ||||
1574 | } | ||||
1575 | | ||||
1576 | currentJob->setLeadTime(previousJob->getCompletionTime().secsTo(currentJob->getStartupTime())); | ||||
1577 | } | ||||
1578 | | ||||
1562 | // This job is non-movable, we're done | 1579 | // This job is non-movable, we're done | ||
1580 | currentJob->setScore(calculateJobScore(currentJob, now)); | ||||
1563 | currentJob->setState(SchedulerJob::JOB_SCHEDULED); | 1581 | currentJob->setState(SchedulerJob::JOB_SCHEDULED); | ||
1564 | qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' is scheduled to start at %2, in compliance with fixed startup time requirement.") | 1582 | qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' is scheduled to start at %2, in compliance with fixed startup time requirement.") | ||
1565 | .arg(currentJob->getName()) | 1583 | .arg(currentJob->getName()) | ||
1566 | .arg(currentJob->getStartupTime().toString(currentJob->getDateTimeDisplayFormat())); | 1584 | .arg(currentJob->getStartupTime().toString(currentJob->getDateTimeDisplayFormat())); | ||
1567 | 1585 | | |||
1568 | break; | 1586 | break; | ||
1569 | } | 1587 | } | ||
1570 | 1588 | | |||
▲ Show 20 Lines • Show All 5546 Lines • Show Last 20 Lines |