mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
## What changed Adds an admin RPC (`MigrateSchedule`) that migrates workflow-backed (V1) schedulers to CHASM (V2) schedulers. The flow: 1. Admin API signals the V1 scheduler workflow with `migrate-to-chasm` 2. V1 workflow runs a local activity that snapshots state and calls `CreateFromMigrationState` on the CHASM scheduler service 3. On success, the V1 workflow closes. On failure, a `PendingMigration` flag persists so the next run loop iteration retries automatically Key details: - `CreateSchedulerFromMigration` initializes the full CHASM scheduler tree (generator, invoker, backfillers, visibility) from V1 state - Running/completed workflows are converted to buffered starts; ongoing backfills are preserved - Migration is idempotent -- if the CHASM schedule already exists, it's treated as success - Metrics: `schedule_migration_started`, `schedule_migration_completed`, `schedule_migration_failed` (with direction tag) - Local activity uses 10m schedule-to-close timeout; retries happen at the workflow level via the persistent flag ## Why Needed for migrating existing V1 schedulers to CHASM without downtime or data loss. ## Follow-up items - V2 to V1 migration (rollback path) - Sentinel key handling when `EnableCHASMSchedulerCreation` was previously enabled - Attach completion callbacks to running workflows after migration
333 lines
15 KiB
Go
333 lines
15 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// plugins:
|
|
// - protoc-gen-go-grpc
|
|
// - protoc
|
|
// source: temporal/server/chasm/lib/scheduler/proto/v1/service.proto
|
|
|
|
package schedulerpb
|
|
|
|
import (
|
|
context "context"
|
|
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.32.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion7
|
|
|
|
const (
|
|
SchedulerService_CreateSchedule_FullMethodName = "/temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService/CreateSchedule"
|
|
SchedulerService_UpdateSchedule_FullMethodName = "/temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService/UpdateSchedule"
|
|
SchedulerService_PatchSchedule_FullMethodName = "/temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService/PatchSchedule"
|
|
SchedulerService_DeleteSchedule_FullMethodName = "/temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService/DeleteSchedule"
|
|
SchedulerService_DescribeSchedule_FullMethodName = "/temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService/DescribeSchedule"
|
|
SchedulerService_ListScheduleMatchingTimes_FullMethodName = "/temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService/ListScheduleMatchingTimes"
|
|
SchedulerService_CreateFromMigrationState_FullMethodName = "/temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService/CreateFromMigrationState"
|
|
)
|
|
|
|
// SchedulerServiceClient is the client API for SchedulerService service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
type SchedulerServiceClient interface {
|
|
CreateSchedule(ctx context.Context, in *CreateScheduleRequest, opts ...grpc.CallOption) (*CreateScheduleResponse, error)
|
|
UpdateSchedule(ctx context.Context, in *UpdateScheduleRequest, opts ...grpc.CallOption) (*UpdateScheduleResponse, error)
|
|
PatchSchedule(ctx context.Context, in *PatchScheduleRequest, opts ...grpc.CallOption) (*PatchScheduleResponse, error)
|
|
DeleteSchedule(ctx context.Context, in *DeleteScheduleRequest, opts ...grpc.CallOption) (*DeleteScheduleResponse, error)
|
|
DescribeSchedule(ctx context.Context, in *DescribeScheduleRequest, opts ...grpc.CallOption) (*DescribeScheduleResponse, error)
|
|
ListScheduleMatchingTimes(ctx context.Context, in *ListScheduleMatchingTimesRequest, opts ...grpc.CallOption) (*ListScheduleMatchingTimesResponse, error)
|
|
CreateFromMigrationState(ctx context.Context, in *CreateFromMigrationStateRequest, opts ...grpc.CallOption) (*CreateFromMigrationStateResponse, error)
|
|
}
|
|
|
|
type schedulerServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewSchedulerServiceClient(cc grpc.ClientConnInterface) SchedulerServiceClient {
|
|
return &schedulerServiceClient{cc}
|
|
}
|
|
|
|
func (c *schedulerServiceClient) CreateSchedule(ctx context.Context, in *CreateScheduleRequest, opts ...grpc.CallOption) (*CreateScheduleResponse, error) {
|
|
out := new(CreateScheduleResponse)
|
|
err := c.cc.Invoke(ctx, SchedulerService_CreateSchedule_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *schedulerServiceClient) UpdateSchedule(ctx context.Context, in *UpdateScheduleRequest, opts ...grpc.CallOption) (*UpdateScheduleResponse, error) {
|
|
out := new(UpdateScheduleResponse)
|
|
err := c.cc.Invoke(ctx, SchedulerService_UpdateSchedule_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *schedulerServiceClient) PatchSchedule(ctx context.Context, in *PatchScheduleRequest, opts ...grpc.CallOption) (*PatchScheduleResponse, error) {
|
|
out := new(PatchScheduleResponse)
|
|
err := c.cc.Invoke(ctx, SchedulerService_PatchSchedule_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *schedulerServiceClient) DeleteSchedule(ctx context.Context, in *DeleteScheduleRequest, opts ...grpc.CallOption) (*DeleteScheduleResponse, error) {
|
|
out := new(DeleteScheduleResponse)
|
|
err := c.cc.Invoke(ctx, SchedulerService_DeleteSchedule_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *schedulerServiceClient) DescribeSchedule(ctx context.Context, in *DescribeScheduleRequest, opts ...grpc.CallOption) (*DescribeScheduleResponse, error) {
|
|
out := new(DescribeScheduleResponse)
|
|
err := c.cc.Invoke(ctx, SchedulerService_DescribeSchedule_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *schedulerServiceClient) ListScheduleMatchingTimes(ctx context.Context, in *ListScheduleMatchingTimesRequest, opts ...grpc.CallOption) (*ListScheduleMatchingTimesResponse, error) {
|
|
out := new(ListScheduleMatchingTimesResponse)
|
|
err := c.cc.Invoke(ctx, SchedulerService_ListScheduleMatchingTimes_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *schedulerServiceClient) CreateFromMigrationState(ctx context.Context, in *CreateFromMigrationStateRequest, opts ...grpc.CallOption) (*CreateFromMigrationStateResponse, error) {
|
|
out := new(CreateFromMigrationStateResponse)
|
|
err := c.cc.Invoke(ctx, SchedulerService_CreateFromMigrationState_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// SchedulerServiceServer is the server API for SchedulerService service.
|
|
// All implementations must embed UnimplementedSchedulerServiceServer
|
|
// for forward compatibility
|
|
type SchedulerServiceServer interface {
|
|
CreateSchedule(context.Context, *CreateScheduleRequest) (*CreateScheduleResponse, error)
|
|
UpdateSchedule(context.Context, *UpdateScheduleRequest) (*UpdateScheduleResponse, error)
|
|
PatchSchedule(context.Context, *PatchScheduleRequest) (*PatchScheduleResponse, error)
|
|
DeleteSchedule(context.Context, *DeleteScheduleRequest) (*DeleteScheduleResponse, error)
|
|
DescribeSchedule(context.Context, *DescribeScheduleRequest) (*DescribeScheduleResponse, error)
|
|
ListScheduleMatchingTimes(context.Context, *ListScheduleMatchingTimesRequest) (*ListScheduleMatchingTimesResponse, error)
|
|
CreateFromMigrationState(context.Context, *CreateFromMigrationStateRequest) (*CreateFromMigrationStateResponse, error)
|
|
mustEmbedUnimplementedSchedulerServiceServer()
|
|
}
|
|
|
|
// UnimplementedSchedulerServiceServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedSchedulerServiceServer struct {
|
|
}
|
|
|
|
func (UnimplementedSchedulerServiceServer) CreateSchedule(context.Context, *CreateScheduleRequest) (*CreateScheduleResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method CreateSchedule not implemented")
|
|
}
|
|
func (UnimplementedSchedulerServiceServer) UpdateSchedule(context.Context, *UpdateScheduleRequest) (*UpdateScheduleResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateSchedule not implemented")
|
|
}
|
|
func (UnimplementedSchedulerServiceServer) PatchSchedule(context.Context, *PatchScheduleRequest) (*PatchScheduleResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method PatchSchedule not implemented")
|
|
}
|
|
func (UnimplementedSchedulerServiceServer) DeleteSchedule(context.Context, *DeleteScheduleRequest) (*DeleteScheduleResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method DeleteSchedule not implemented")
|
|
}
|
|
func (UnimplementedSchedulerServiceServer) DescribeSchedule(context.Context, *DescribeScheduleRequest) (*DescribeScheduleResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method DescribeSchedule not implemented")
|
|
}
|
|
func (UnimplementedSchedulerServiceServer) ListScheduleMatchingTimes(context.Context, *ListScheduleMatchingTimesRequest) (*ListScheduleMatchingTimesResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method ListScheduleMatchingTimes not implemented")
|
|
}
|
|
func (UnimplementedSchedulerServiceServer) CreateFromMigrationState(context.Context, *CreateFromMigrationStateRequest) (*CreateFromMigrationStateResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method CreateFromMigrationState not implemented")
|
|
}
|
|
func (UnimplementedSchedulerServiceServer) mustEmbedUnimplementedSchedulerServiceServer() {}
|
|
|
|
// UnsafeSchedulerServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to SchedulerServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeSchedulerServiceServer interface {
|
|
mustEmbedUnimplementedSchedulerServiceServer()
|
|
}
|
|
|
|
func RegisterSchedulerServiceServer(s grpc.ServiceRegistrar, srv SchedulerServiceServer) {
|
|
s.RegisterService(&SchedulerService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _SchedulerService_CreateSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(CreateScheduleRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SchedulerServiceServer).CreateSchedule(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SchedulerService_CreateSchedule_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SchedulerServiceServer).CreateSchedule(ctx, req.(*CreateScheduleRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SchedulerService_UpdateSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(UpdateScheduleRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SchedulerServiceServer).UpdateSchedule(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SchedulerService_UpdateSchedule_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SchedulerServiceServer).UpdateSchedule(ctx, req.(*UpdateScheduleRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SchedulerService_PatchSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(PatchScheduleRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SchedulerServiceServer).PatchSchedule(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SchedulerService_PatchSchedule_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SchedulerServiceServer).PatchSchedule(ctx, req.(*PatchScheduleRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SchedulerService_DeleteSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(DeleteScheduleRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SchedulerServiceServer).DeleteSchedule(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SchedulerService_DeleteSchedule_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SchedulerServiceServer).DeleteSchedule(ctx, req.(*DeleteScheduleRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SchedulerService_DescribeSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(DescribeScheduleRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SchedulerServiceServer).DescribeSchedule(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SchedulerService_DescribeSchedule_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SchedulerServiceServer).DescribeSchedule(ctx, req.(*DescribeScheduleRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SchedulerService_ListScheduleMatchingTimes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ListScheduleMatchingTimesRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SchedulerServiceServer).ListScheduleMatchingTimes(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SchedulerService_ListScheduleMatchingTimes_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SchedulerServiceServer).ListScheduleMatchingTimes(ctx, req.(*ListScheduleMatchingTimesRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SchedulerService_CreateFromMigrationState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(CreateFromMigrationStateRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SchedulerServiceServer).CreateFromMigrationState(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SchedulerService_CreateFromMigrationState_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SchedulerServiceServer).CreateFromMigrationState(ctx, req.(*CreateFromMigrationStateRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// SchedulerService_ServiceDesc is the grpc.ServiceDesc for SchedulerService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var SchedulerService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "temporal.server.chasm.lib.scheduler.proto.v1.SchedulerService",
|
|
HandlerType: (*SchedulerServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "CreateSchedule",
|
|
Handler: _SchedulerService_CreateSchedule_Handler,
|
|
},
|
|
{
|
|
MethodName: "UpdateSchedule",
|
|
Handler: _SchedulerService_UpdateSchedule_Handler,
|
|
},
|
|
{
|
|
MethodName: "PatchSchedule",
|
|
Handler: _SchedulerService_PatchSchedule_Handler,
|
|
},
|
|
{
|
|
MethodName: "DeleteSchedule",
|
|
Handler: _SchedulerService_DeleteSchedule_Handler,
|
|
},
|
|
{
|
|
MethodName: "DescribeSchedule",
|
|
Handler: _SchedulerService_DescribeSchedule_Handler,
|
|
},
|
|
{
|
|
MethodName: "ListScheduleMatchingTimes",
|
|
Handler: _SchedulerService_ListScheduleMatchingTimes_Handler,
|
|
},
|
|
{
|
|
MethodName: "CreateFromMigrationState",
|
|
Handler: _SchedulerService_CreateFromMigrationState_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "temporal/server/chasm/lib/scheduler/proto/v1/service.proto",
|
|
}
|