Skip to content

bloqade.save not uniformly applicable #1052

@jon-wurtz

Description

@jon-wurtz

Describe the bug
Calling bloqade.analog.save(program) on a program made via a builder raises the error

TypeError: Object of type <class 'bloqade.analog.builder.waveform.Apply'> is not JSON serializable. Only (<class 'bloqade.analog.task.base.Geometry'>, <class 'bloqade.analog.task.exclusive.ExclusiveRemoteTask'>, <class 'bloqade.analog.task.quera.QuEraTask'>, <class 'bloqade.analog.task.braket.BraketTask'>, <class 'bloqade.analog.emulate.ir.atom_type.ThreeLevelAtomType'>, <class 'bloqade.analog.emulate.ir.atom_type.TwoLevelAtomType'>, <class 'bloqade.analog.emulate.ir.emulator.JITWaveform'>, <class 'bloqade.analog.emulate.ir.emulator.RabiOperatorData'>, <class 'bloqade.analog.emulate.ir.emulator.RabiTerm'>, <class 'bloqade.analog.emulate.ir.emulator.DetuningOperatorData'>, <class 'bloqade.analog.emulate.ir.emulator.DetuningTerm'>, <class 'bloqade.analog.emulate.ir.emulator.Fields'>, <class 'bloqade.analog.emulate.ir.emulator.Register'>, <class 'bloqade.analog.emulate.ir.emulator.EmulatorProgram'>, <class 'bloqade.analog.task.bloqade.BloqadeTask'>, <class 'bloqade.analog.task.braket_simulator.BraketEmulatorTask'>, <class 'bloqade.analog.task.batch.LocalBatch'>, <class 'bloqade.analog.task.batch.TaskError'>, <class 'bloqade.analog.task.batch.BatchErrors'>, <class 'bloqade.analog.task.batch.RemoteBatch'>) are supported.

This behavior extends beyond save with other methods as well.

Minimal broken example
A program where the last chain define is apply

Expected behavior
Programs should have indistinguishable behavior independent of how they are built

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions