Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
revert plugin.go
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <pingsutw@apache.org>
  • Loading branch information
pingsutw committed Sep 12, 2023
1 parent 4b2da50 commit cd67d94
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions go/tasks/plugins/webapi/agent/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ import (
"encoding/gob"
"fmt"

"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flytestdlib/config"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"

"google.golang.org/grpc/grpclog"

"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
flyteIdl "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/service"
pluginErrors "github.com/flyteorg/flyteplugins/go/tasks/errors"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/core"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/core/template"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/io"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/ioutils"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/webapi"
"github.com/flyteorg/flytestdlib/config"
"github.com/flyteorg/flytestdlib/logger"
"github.com/flyteorg/flytestdlib/promutils"
"google.golang.org/grpc"
)
Expand Down Expand Up @@ -170,17 +169,11 @@ func (p Plugin) Status(ctx context.Context, taskCtx webapi.StatusContext) (phase
case admin.State_RETRYABLE_FAILURE:
return core.PhaseInfoRetryableFailure(pluginErrors.TaskFailedWithError, "failed to run the job", taskInfo), nil
case admin.State_SUCCEEDED:
var opReader io.OutputReader
if resource.Outputs != nil {
logger.Infof(ctx, "Agent returned an output")
opReader = ioutils.NewInMemoryOutputReader(resource.Outputs, nil, nil)
} else {
logger.Infof(ctx, "Agent didn't return any output, assuming file based outputs.")
opReader = ioutils.NewRemoteFileOutputReader(ctx, taskCtx.DataStore(), taskCtx.OutputWriter(), taskCtx.MaxDatasetSizeBytes())
}
err := taskCtx.OutputWriter().Put(ctx, opReader)
if err != nil {
return core.PhaseInfoUndefined, err
err := taskCtx.OutputWriter().Put(ctx, ioutils.NewInMemoryOutputReader(resource.Outputs, nil, nil))
if err != nil {
return core.PhaseInfoUndefined, err
}
}
return core.PhaseInfoSuccess(taskInfo), nil
}
Expand Down

0 comments on commit cd67d94

Please sign in to comment.