Skip to content

Commit

Permalink
new sequence model with changes in offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiaggio committed Oct 30, 2024
1 parent aeed374 commit 82c0e6e
Show file tree
Hide file tree
Showing 20 changed files with 273 additions and 203 deletions.
74 changes: 48 additions & 26 deletions modules/model/shared/src/main/scala/observe/model/ObserveStep.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import lucuma.core.enums.Breakpoint
import lucuma.core.enums.Instrument
import lucuma.core.model.sequence.Step
import lucuma.core.model.sequence.StepConfig
import lucuma.core.model.sequence.TelescopeConfig
import lucuma.odb.json.offset.transport.given
import lucuma.odb.json.stepconfig.given
import monocle.Focus
Expand All @@ -25,38 +26,59 @@ import observe.model.enums.*
import observe.model.enums.PendingObserveCmd

enum ObserveStep(
val id: Step.Id,
val instConfig: InstrumentDynamicConfig,
val stepConfig: StepConfig,
val status: StepState,
val breakpoint: Breakpoint,
val fileId: Option[ImageFileId],
val configStatus: List[(Resource | Instrument, ActionStatus)]
val id: Step.Id,
val instConfig: InstrumentDynamicConfig,
val stepConfig: StepConfig,
val telescopeConfig: TelescopeConfig,
val status: StepState,
val breakpoint: Breakpoint,
val fileId: Option[ImageFileId],
val configStatus: List[(Resource | Instrument, ActionStatus)]
) derives Eq,
Encoder.AsObject,
Decoder:
case Standard(
override val id: Step.Id,
override val instConfig: InstrumentDynamicConfig,
override val stepConfig: StepConfig,
override val status: StepState,
override val breakpoint: Breakpoint,
override val fileId: Option[ImageFileId],
override val configStatus: List[(Resource | Instrument, ActionStatus)],
val observeStatus: ActionStatus
) extends ObserveStep(id, instConfig, stepConfig, status, breakpoint, fileId, configStatus)
override val id: Step.Id,
override val instConfig: InstrumentDynamicConfig,
override val stepConfig: StepConfig,
override val telescopeConfig: TelescopeConfig,
override val status: StepState,
override val breakpoint: Breakpoint,
override val fileId: Option[ImageFileId],
override val configStatus: List[(Resource | Instrument, ActionStatus)],
val observeStatus: ActionStatus
) extends ObserveStep(
id,
instConfig,
stepConfig,
telescopeConfig,
status,
breakpoint,
fileId,
configStatus
)

case NodAndShuffle(
override val id: Step.Id,
override val instConfig: InstrumentDynamicConfig,
override val stepConfig: StepConfig,
override val status: StepState,
override val breakpoint: Breakpoint,
override val fileId: Option[ImageFileId],
override val configStatus: List[(Resource | Instrument, ActionStatus)],
val nsStatus: NodAndShuffleStatus,
val pendingObserveCmd: Option[PendingObserveCmd]
) extends ObserveStep(id, instConfig, stepConfig, status, breakpoint, fileId, configStatus)
override val id: Step.Id,
override val instConfig: InstrumentDynamicConfig,
override val stepConfig: StepConfig,
override val telescopeConfig: TelescopeConfig,
override val status: StepState,
override val breakpoint: Breakpoint,
override val fileId: Option[ImageFileId],
override val configStatus: List[(Resource | Instrument, ActionStatus)],
val nsStatus: NodAndShuffleStatus,
val pendingObserveCmd: Option[PendingObserveCmd]
) extends ObserveStep(
id,
instConfig,
stepConfig,
telescopeConfig,
status,
breakpoint,
fileId,
configStatus
)

object ObserveStep:
// Derivation doesn't generate instances for subtypes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import lucuma.core.enums.Breakpoint
import lucuma.core.enums.Instrument
import lucuma.core.model.sequence.Step
import lucuma.core.model.sequence.StepConfig
import lucuma.core.model.sequence.TelescopeConfig
import lucuma.core.model.sequence.arb.ArbStepConfig.given
import lucuma.core.model.sequence.arb.ArbTelescopeConfig.given
import lucuma.core.util.TimeSpan
import lucuma.core.util.arb.ArbEnumerated.given
import lucuma.core.util.arb.ArbTimeSpan.given
Expand Down Expand Up @@ -58,6 +60,7 @@ trait ArbNodAndShuffleStep {
id <- arbitrary[Step.Id]
d <- arbitrary[InstrumentDynamicConfig]
t <- arbitrary[StepConfig]
tc <- arbitrary[TelescopeConfig]
s <- arbitrary[StepState]
b <- arbitrary[Breakpoint]
f <- arbitrary[Option[dhs.ImageFileId]]
Expand All @@ -68,6 +71,7 @@ trait ArbNodAndShuffleStep {
id = id,
instConfig = d,
stepConfig = t,
telescopeConfig = tc,
status = s,
breakpoint = b,
fileId = f,
Expand All @@ -83,6 +87,7 @@ trait ArbNodAndShuffleStep {
Step.Id,
InstrumentDynamicConfig,
StepConfig,
TelescopeConfig,
StepState,
Breakpoint,
Option[dhs.ImageFileId],
Expand All @@ -93,6 +98,7 @@ trait ArbNodAndShuffleStep {
(s.id,
s.instConfig,
s.stepConfig,
s.telescopeConfig,
s.status,
s.breakpoint,
s.fileId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import lucuma.core.enums.Breakpoint
import lucuma.core.enums.Instrument
import lucuma.core.model.sequence.Step
import lucuma.core.model.sequence.StepConfig
import lucuma.core.model.sequence.TelescopeConfig
import lucuma.core.model.sequence.arb.ArbStepConfig.given
import lucuma.core.model.sequence.arb.ArbTelescopeConfig.given
import lucuma.core.util.arb.ArbEnumerated.given
import lucuma.core.util.arb.ArbUid.given
import observe.model.*
Expand All @@ -29,6 +31,7 @@ trait ArbStandardStep {
d <- arbitrary[InstrumentDynamicConfig]
t <- arbitrary[StepConfig]
s <- arbitrary[StepState]
tc <- arbitrary[TelescopeConfig]
b <- arbitrary[Breakpoint]
f <- arbitrary[Option[dhs.ImageFileId]]
cs <- arbitrary[List[(Resource, ActionStatus)]]
Expand All @@ -37,6 +40,7 @@ trait ArbStandardStep {
id = id,
instConfig = d,
stepConfig = t,
telescopeConfig = tc,
status = s,
breakpoint = b,
fileId = f,
Expand All @@ -51,6 +55,7 @@ trait ArbStandardStep {
Step.Id,
InstrumentDynamicConfig,
StepConfig,
TelescopeConfig,
StepState,
Breakpoint,
Option[dhs.ImageFileId],
Expand All @@ -61,6 +66,7 @@ trait ArbStandardStep {
(s.id,
s.instConfig,
s.stepConfig,
s.telescopeConfig,
s.status,
s.breakpoint,
s.fileId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,16 @@ object ObsQueriesGQL:
diffuser
shutter
}
... on Science {
offset { ...offsetFields }
guiding
}
... on SmartGcal {
smartGcalType
}
}
fragment telescopeConfigFields on TelescopeConfig {
offset { ...offsetFields }
guiding
}
fragment stepEstimateFields on StepEstimate {
configChange {
all {
Expand Down Expand Up @@ -202,6 +203,9 @@ object ObsQueriesGQL:
stepConfig {
...stepConfigFields
}
telescopeConfig {
...telescopeConfigFields
}
estimate {
...stepEstimateFields
}
Expand Down Expand Up @@ -249,6 +253,9 @@ object ObsQueriesGQL:
stepConfig {
...stepConfigFields
}
telescopeConfig {
...telescopeConfigFields
}
estimate {
...stepEstimateFields
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ object ObserveEngine {

private def stepRequiresChecks(stepConfig: OcsStepConfig): Boolean = stepConfig match {
case OcsStepConfig.Gcal(_, _, _, _) => true
case OcsStepConfig.Science(_, _) => true
case OcsStepConfig.Science => true
case OcsStepConfig.SmartGcal(_) => true
case _ => false
}
Expand Down Expand Up @@ -1724,8 +1724,9 @@ object ObserveEngine {

val engSteps = engineSteps(seq)
val stepResources = engSteps.map {
case ObserveStep.Standard(id, _, _, _, _, _, configStatus, _) => id -> configStatus.toMap
case ObserveStep.NodAndShuffle(id, _, _, _, _, _, configStatus, _, _) =>
case ObserveStep.Standard(id, _, _, _, _, _, _, configStatus, _) =>
id -> configStatus.toMap
case ObserveStep.NodAndShuffle(id, _, _, _, _, _, _, configStatus, _, _) =>
id -> configStatus.toMap
}.toMap

Expand Down
Loading

0 comments on commit 82c0e6e

Please sign in to comment.