Skip to content
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

Migrate to latest schema with changes in the sequence #598

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ val Versions = new { // sbt doesn't like object definitions in build.sbt
val disciplineMUnit = "2.0.0"
val fs2 = "3.11.0"
val kittens = "3.4.0"
val lucumaCore = "0.106.4"
val lucumaODBSchema = "0.15.0"
val lucumaCore = "0.107.0"
val lucumaODBSchema = "0.16.0"
val munit = "1.0.2"
val munitCatsEffect = "2.0.0"
}

ThisBuild / tlBaseVersion := "0.105"
ThisBuild / tlBaseVersion := "0.106"
ThisBuild / tlCiReleaseBranches := Seq("main")
ThisBuild / crossScalaVersions := Seq("3.5.2")
ThisBuild / tlVersionIntroduced := Map("3" -> "0.29.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,9 @@ type GmosNorthStep {
"""The sequence step itself"""
stepConfig: StepConfig!

"""The telescope configuration at this step."""
telescopeConfig: TelescopeConfig!

"""Time estimate for this step's execution"""
estimate: StepEstimate!

Expand Down Expand Up @@ -1970,6 +1973,9 @@ type GmosSouthStep {
"""The sequence step itself"""
stepConfig: StepConfig!

"""The telescope configuration at this step."""
telescopeConfig: TelescopeConfig!

"""Time estimate for this step's execution"""
estimate: StepEstimate!

Expand Down Expand Up @@ -3233,6 +3239,7 @@ input RecordGmosNorthStepInput {
atomId: AtomId!
gmosNorth: GmosNorthDynamicInput!
stepConfig: StepConfigInput!
telescopeConfig: TelescopeConfigInput
observeClass: ObserveClass!
generatedId: StepId
}
Expand Down Expand Up @@ -3260,6 +3267,7 @@ input RecordGmosSouthStepInput {
atomId: AtomId!
gmosSouth: GmosSouthDynamicInput!
stepConfig: StepConfigInput!
telescopeConfig: TelescopeConfigInput
observeClass: ObserveClass!
generatedId: StepId
}
Expand Down Expand Up @@ -3293,12 +3301,6 @@ input RightAscensionInput {

"""Science step"""
type Science implements StepConfig {
"""Offset"""
offset: Offset!

"""Guide State (whether guiding is enabled for this step)"""
guiding: GuideState!

"""Step type is always SCIENCE."""
stepType: StepType!
}
Expand Down Expand Up @@ -3625,7 +3627,7 @@ input StepConfigInput {
gcal: StepConfigGcalInput

"""Science step creation option"""
science: StepConfigScienceInput
science: Boolean

"""Smart gcal creation option"""
smartGcal: StepConfigSmartGcalInput
Expand All @@ -3643,15 +3645,6 @@ input StepConfigGcalInput {
shutter: GcalShutter!
}

"""Science step creation input"""
input StepConfigScienceInput {
"""offset position"""
offset: OffsetInput!

"""Whether guiding is enabled for this step (defaults to 'ENABLED')."""
guiding: GuideState
}

"""SmartGcal step creation input"""
input StepConfigSmartGcalInput {
"""Smart Gcal type"""
Expand Down Expand Up @@ -3809,6 +3802,23 @@ input TargetPropertiesInput {
existence: Existence
}

type TelescopeConfig {
"""Offset"""
offset: Offset!

"""Guide State (whether guiding is enabled for this step)"""
guiding: GuideState!
}

"""Science step creation input"""
input TelescopeConfigInput {
"""Offset position, which defaults to (0, 0) arcsec."""
offset: OffsetInput

"""Whether guiding is enabled for this step (defaults to 'ENABLED')."""
guiding: GuideState
}

"""
Time Accounting Categories. Each successful proposal is given one or more
time allocations and each allocation has a time accounting category.
Expand Down Expand Up @@ -8262,6 +8272,9 @@ type StepRecord {
"""
stepConfig: StepConfig!

"""The telescope configuration for this step."""
telescopeConfig: TelescopeConfig!

"""The observe class of this step."""
observeClass: ObserveClass!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ object SequenceQueriesGQL:
diffuser
shutter
}
... on Science {
offset { ...offsetFields }
guiding
}
... on SmartGcal {
smartGcalType
}
Expand Down Expand Up @@ -133,6 +129,10 @@ object SequenceQueriesGQL:
stepConfig {
...stepConfigFields
}
telescopeConfig {
offset { ...offsetFields }
guiding
}
estimate {
...stepEstimateFields
}
Expand Down Expand Up @@ -180,6 +180,10 @@ object SequenceQueriesGQL:
stepConfig {
...stepConfigFields
}
telescopeConfig {
offset { ...offsetFields }
guiding
}
estimate {
...stepEstimateFields
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ object ExecutionVisitsSubquery
diffuser
shutter
}
... on Science {
offset $OffsetSubquery
guiding
}
}
telescopeConfig {
offset $OffsetSubquery
guiding
}
observeClass
qaState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import lucuma.core.math.dimensional.*
import lucuma.core.model.*
import lucuma.core.model.ExposureTimeMode.*
import lucuma.core.model.sequence.StepConfig
import lucuma.core.model.sequence.TelescopeConfig
import lucuma.core.model.sequence.gmos.DynamicConfig
import lucuma.core.model.sequence.gmos.GmosCcdMode
import lucuma.core.model.sequence.gmos.GmosFpuMask
Expand Down Expand Up @@ -481,14 +482,16 @@ extension (g: GmosFpuMask.Custom)

extension (g: GmosFpuMask[GmosSouthFpu])
def toInput: GmosSouthFpuInput =
GmosSouthFpuInput(customMask = g.custom.map(_.toInput).orUnassign,
builtin = g.builtinFpu.orUnassign
GmosSouthFpuInput(
customMask = g.custom.map(_.toInput).orUnassign,
builtin = g.builtinFpu.orUnassign
)

extension (g: GmosFpuMask[GmosNorthFpu])
def toInput: GmosNorthFpuInput =
GmosNorthFpuInput(customMask = g.custom.map(_.toInput).orUnassign,
builtin = g.builtinFpu.orUnassign
GmosNorthFpuInput(
customMask = g.custom.map(_.toInput).orUnassign,
builtin = g.builtinFpu.orUnassign
)
extension (ns: GmosNodAndShuffle)
def toInput: GmosNodAndShuffleInput = GmosNodAndShuffleInput(
Expand Down Expand Up @@ -538,7 +541,7 @@ extension (gmosNDynamic: DynamicConfig.GmosNorth)
)

extension (sc: StepConfig)
def toInput: StepConfigInput = sc match {
def toInput: StepConfigInput = sc match
case StepConfig.Bias =>
StepConfigInput(bias = true.assign)

Expand All @@ -555,16 +558,13 @@ extension (sc: StepConfig)
)
StepConfigInput(gcal = gcal.assign)

case StepConfig.Science(offset, guiding) =>
val science = StepConfigScienceInput(
offset = offset.toInput,
guiding = guiding.assign
)
StepConfigInput(science = science.assign)
case StepConfig.Science =>
StepConfigInput(science = true.assign)

case StepConfig.SmartGcal(smartGcalType) =>
val smartGcal = StepConfigSmartGcalInput(
smartGcalType = smartGcalType
)
val smartGcal = StepConfigSmartGcalInput(smartGcalType = smartGcalType)
StepConfigInput(smartGcal = smartGcal.assign)
}

extension (tc: TelescopeConfig)
def toInput: TelescopeConfigInput =
TelescopeConfigInput(offset = tc.offset.toInput.assign, guiding = tc.guiding.assign)
4 changes: 3 additions & 1 deletion lucuma-schemas/src/test/resources/visitGmosNorth.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"fpu": null
},
"stepConfig": {
"stepType": "SCIENCE",
"stepType": "SCIENCE"
},
"telescopeConfig": {
"offset": {
"p": {
"microarcseconds": 0
Expand Down
4 changes: 3 additions & 1 deletion lucuma-schemas/src/test/resources/visitGmosSouth.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"fpu": null
},
"stepConfig": {
"stepType": "SCIENCE",
"stepType": "SCIENCE"
},
"telescopeConfig": {
"offset": {
"p": {
"microarcseconds": 0
Expand Down
63 changes: 10 additions & 53 deletions lucuma-schemas/src/test/resources/visitsQuery.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
query {
observation(observationId: "o-14d") {
execution {
visits {
matches {
id
Expand Down Expand Up @@ -66,17 +67,17 @@ query {
diffuser
shutter
}
... on Science {
offset {
p {
microarcseconds
}
q {
microarcseconds
}
}
telescopeConfig {
offset {
p {
microarcseconds
}
q {
microarcseconds
}
guiding
}
guiding
}
observeClass
qaState
Expand All @@ -101,47 +102,3 @@ query {
}
}
}

fragment nodAndShuffleFields on GmosNodAndShuffle {
posA {
p {
microarcseconds
}
q {
microarcseconds
}
}
posB {
p {
microarcseconds
}
q {
microarcseconds
}
}
eOffset
shuffleOffset
shuffleCycles
}

fragment gmosNorthStaticConfigFields on GmosNorthExecutionConfig {
static {
stageMode
detector
mosPreImaging
nodAndShuffle {
...nodAndShuffleFields
}
}
}

fragment gmosSouthStaticConfigFields on GmosSouthExecutionConfig {
static {
stageMode
detector
mosPreImaging
nodAndShuffle {
...nodAndShuffleFields
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ class VisitDecodersSuite extends InputStreamSuite {
filter = Some(GmosNorthFilter.RPrime),
fpu = none
),
stepConfig = StepConfig.Science(
stepConfig = StepConfig.Science,
telescopeConfig = TelescopeConfig(
offset = Offset(Offset.P.Zero, Offset.Q.Zero),
guiding = StepGuideState.Enabled
),
Expand Down Expand Up @@ -183,7 +184,8 @@ class VisitDecodersSuite extends InputStreamSuite {
filter = Some(GmosSouthFilter.RPrime),
fpu = none
),
stepConfig = StepConfig.Science(
stepConfig = StepConfig.Science,
telescopeConfig = TelescopeConfig(
offset = Offset(Offset.P.Zero, Offset.Q.Zero),
guiding = StepGuideState.Enabled
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import lucuma.core.enums.SequenceType
import lucuma.core.model.sequence.Atom
import lucuma.core.model.sequence.Step
import lucuma.core.model.sequence.StepConfig
import lucuma.core.model.sequence.TelescopeConfig
import lucuma.core.model.sequence.gmos.DynamicConfig
import lucuma.core.util.Timestamp
import lucuma.core.util.TimestampInterval
Expand Down Expand Up @@ -53,6 +54,7 @@ trait VisitDecoders:
interval <- c.downField("interval").as[Option[TimestampInterval]]
instrumentConfig <- c.downField("gmosNorth").as[DynamicConfig.GmosNorth]
stepConfig <- c.downField("stepConfig").as[StepConfig]
telescopeConfig <- c.downField("telescopeConfig").as[TelescopeConfig]
observeClass <- c.downField("observeClass").as[ObserveClass]
qaState <- c.downField("qaState").as[Option[DatasetQaState]]
datasets <- c.downField("datasets").downField("matches").as[List[Dataset]]
Expand All @@ -64,6 +66,7 @@ trait VisitDecoders:
interval,
instrumentConfig,
stepConfig,
telescopeConfig,
observeClass,
qaState,
datasets,
Expand All @@ -78,6 +81,7 @@ trait VisitDecoders:
interval <- c.downField("interval").as[Option[TimestampInterval]]
instrumentConfig <- c.downField("gmosSouth").as[DynamicConfig.GmosSouth]
stepConfig <- c.downField("stepConfig").as[StepConfig]
telescopeConfig <- c.downField("telescopeConfig").as[TelescopeConfig]
observeClass <- c.downField("observeClass").as[ObserveClass]
qaState <- c.downField("qaState").as[Option[DatasetQaState]]
datasets <- c.downField("datasets").downField("matches").as[List[Dataset]]
Expand All @@ -89,6 +93,7 @@ trait VisitDecoders:
interval,
instrumentConfig,
stepConfig,
telescopeConfig,
observeClass,
qaState,
datasets,
Expand Down
Loading
Loading