[ https://issues.apache.org/jira/browse/BEAM-11104?focusedWorklogId=753448&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-753448 ]
ASF GitHub Bot logged work on BEAM-11104: ----------------------------------------- Author: ASF GitHub Bot Created on: 06/Apr/22 15:03 Start Date: 06/Apr/22 15:03 Worklog Time Spent: 10m Work Description: jrmccluskey commented on code in PR #17265: URL: https://github.com/apache/beam/pull/17265#discussion_r844060105 ########## sdks/go/pkg/beam/core/sdf/continuation.go: ########## @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sdf + +import "time" + +// ProcessContinuation is an interface used to signal that a splittable DoFn should be +// split and resumed at a later time. The ProcessContinuation can be returned from +// a DoFn when it returns, either complete or needing to be resumed. +type ProcessContinuation interface { + // ShouldResume returns a boolean indicating whether the process should be + // resumed at a later time. + ShouldResume() bool + + // ResumeDelay returns a suggested time.Duration to wait before resuming the + // process. The runner is not guaranteed to follow this suggestion. + ResumeDelay() time.Duration +} + +// DefaultProcessContinuation is the SDK-default implementation of the ProcessContinuation +// interface, encapsulating the basic behavior necessary to resume a process later. +type DefaultProcessContinuation struct { + resumes bool + resumeDelay time.Duration +} + +// ShouldResume returns whether or not the DefaultProcessContinuation should lead to the +// process being resumed. +func (p *DefaultProcessContinuation) ShouldResume() bool { + return p.resumes +} + +// ResumeDelay returns the suggested duration that should pass before the process is resumed. +// If the process should not be resumed, the value returned here does not matter. +func (p *DefaultProcessContinuation) ResumeDelay() time.Duration { + return p.resumeDelay +} + +// StoppingProcessContinuation returns a ProcessContinuation that will not resume the process +// later. +func StoppingProcessContinuation() ProcessContinuation { Review Comment: Java's versions are ProcessContinuation.stop() and withResumeDelay() respectively. I don't love stop(), but StopProcessing() and ResumeProcessingIn() are fine Issue Time Tracking ------------------- Worklog Id: (was: 753448) Time Spent: 4h (was: 3h 50m) > [Go SDK] DoFn Self Checkpointing > -------------------------------- > > Key: BEAM-11104 > URL: https://issues.apache.org/jira/browse/BEAM-11104 > Project: Beam > Issue Type: Sub-task > Components: sdk-go > Reporter: Robert Burke > Priority: P3 > Time Spent: 4h > Remaining Estimate: 0h > > Allow SplittableDoFns to self checkpoint. > (To be updated once [https://github.com/apache/beam/pull/13160] is merged and > the programming guide updated with SDF content.) -- This message was sent by Atlassian Jira (v8.20.1#820001)