Skip to content

Commit

Permalink
migrations for new observation workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiaggio committed Oct 30, 2024
1 parent 82c0e6e commit e97b768
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ object ObsQueriesGQL:

@GraphQL
trait ActiveObservationIdsQuery extends GraphQLOperation[ObservationDB]:
// TODO The ODB API doesn't provide a way to filter ready observations,
// so we filter by accepted proposals for now.
// Revise this when the API supports it OR we start getting obersvations from the scheduler.
val document = """
query {
observations(WHERE: { status: { eq: { EQ: READY } } }) {
observations(WHERE: {program: {proposalStatus: {EQ: ACCEPTED}}}) {
matches {
id
title
Expand All @@ -35,8 +38,9 @@ object ObsQueriesGQL:
observation(observationId: $obsId) {
id
title
status
activeStatus
workflow {
state
}
program {
id
name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,7 @@ class ObserveEngineSuite extends TestCommon {
ODBObservation(
id = seqObsId1,
title = "Test Observation".refined,
ObsStatus.Ready,
ObsActiveStatus.Active,
ODBObservation.Workflow(ObservationWorkflowState.Ready),
ODBObservation.Program(
Program.Id(PosLong.unsafeFrom(123)),
None
Expand Down Expand Up @@ -654,8 +653,7 @@ class ObserveEngineSuite extends TestCommon {
ODBObservation(
id = seqObsId1,
title = "Test Observation".refined,
ObsStatus.Ready,
ObsActiveStatus.Active,
ODBObservation.Workflow(ObservationWorkflowState.Ready),
ODBObservation.Program(
Program.Id(PosLong.unsafeFrom(123)),
None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import lucuma.core.enums.GmosYBinning
import lucuma.core.enums.ImageQuality
import lucuma.core.enums.Instrument
import lucuma.core.enums.MosPreImaging
import lucuma.core.enums.ObsActiveStatus
import lucuma.core.enums.ObsStatus
import lucuma.core.enums.ObservationWorkflowState
import lucuma.core.enums.ObserveClass
import lucuma.core.enums.SequenceType
import lucuma.core.enums.Site
Expand Down Expand Up @@ -313,8 +312,7 @@ object TestCommon {
ODBObservation(
id = id,
title = "Test Observation".refined,
ObsStatus.Ready,
ObsActiveStatus.Active,
ODBObservation.Workflow(ObservationWorkflowState.Ready),
ODBObservation.Program(
Program.Id(PosLong.unsafeFrom(123)),
None
Expand Down Expand Up @@ -455,8 +453,7 @@ object TestCommon {
ODBObservation(
id = id,
title = "Test Observation".refined,
ObsStatus.Ready,
ObsActiveStatus.Active,
ODBObservation.Workflow(ObservationWorkflowState.Ready),
ODBObservation.Program(
Program.Id(PosLong.unsafeFrom(123)),
None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import eu.timepit.refined.types.numeric.PosLong
import lucuma.core.enums.CloudExtinction
import lucuma.core.enums.ImageQuality
import lucuma.core.enums.Instrument
import lucuma.core.enums.ObsActiveStatus
import lucuma.core.enums.ObsStatus
import lucuma.core.enums.ObservationWorkflowState
import lucuma.core.enums.ObserveClass
import lucuma.core.enums.SequenceType
import lucuma.core.enums.SkyBackground
Expand All @@ -34,7 +33,9 @@ import lucuma.core.model.sequence.gmos.DynamicConfig
import lucuma.core.model.sequence.gmos.StaticConfig
import lucuma.refined.*
import monocle.syntax.all.focus
import observe.common.ObsQueriesGQL.ObsQuery
import observe.common.ObsQueriesGQL.ObsQuery.Data
import observe.common.ObsQueriesGQL.ObsQuery.Data.Observation as ODBObservation
import observe.common.ObsQueriesGQL.RecordDatasetMutation.Data.RecordDataset.Dataset
import observe.model.dhs.ImageFileId
import observe.model.odb.ObsRecordedIds
Expand Down Expand Up @@ -72,8 +73,7 @@ object TestOdbProxy {
.Observation(
oid,
title = "Test Observation".refined,
ObsStatus.Ready,
ObsActiveStatus.Active,
ODBObservation.Workflow(ObservationWorkflowState.Ready),
Data.Observation.Program(Program.Id(PosLong.unsafeFrom(1))),
Data.Observation.TargetEnvironment.apply(),
ConstraintSet(ImageQuality.TwoPointZero,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ object ObsQueriesGQL {

@GraphQL
trait ActiveObservationIdsQuery extends GraphQLOperation[ObservationDB] {
// TODO The ODB API doesn't provide a way to filter ready observations,
// so we filter by accepted proposals for now.
// Revise this when the API supports it OR we start getting obersvations from the scheduler.
val document = s"""
query {
observations(WHERE: { status: { EQ: READY } }) {
observations(WHERE: {program: {proposalStatus: {EQ: ACCEPTED}}}) {
matches $ObservationSummarySubquery
}
}
Expand Down

0 comments on commit e97b768

Please sign in to comment.