From 0a2fd96b9e976ab1c320987b9fcb73d0433d2ca0 Mon Sep 17 00:00:00 2001 From: "Andrew Jackson (Ajax)" Date: Mon, 28 Aug 2023 11:37:36 -0500 Subject: [PATCH] lotus-provider lint-happy1 --- cmd/lotus-provider/config.go | 61 +++++++++++++++++++ cmd/lotus-provider/main.go | 2 +- lib/harmony/harmonytask/harmonytask.go | 2 +- .../resources/miniopencl/mini_opencl.go | 56 +++++++++++++++++ 4 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 cmd/lotus-provider/config.go diff --git a/cmd/lotus-provider/config.go b/cmd/lotus-provider/config.go new file mode 100644 index 000000000..b7a4c817a --- /dev/null +++ b/cmd/lotus-provider/config.go @@ -0,0 +1,61 @@ +package main + +import ( + "fmt" + + "github.com/urfave/cli/v2" +) + +var configCmd = &cli.Command{ + Name: "config", + Usage: "Manage node config", + Subcommands: []*cli.Command{ + configDefaultCmd, + configSetCmd, + configGetCmd, + }, +} + +var configDefaultCmd = &cli.Command{ + Name: "default", + Usage: "Print default system config", + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "no-comment", + Usage: "don't comment default values", + }, + }, + Action: func(cctx *cli.Context) error { + fmt.Println("[config]\nstatus = Coming Soon") + // [overlay.sealer1.tasks]\nsealer_task_enable = true + return nil + }, +} + +var configSetCmd = &cli.Command{ + Name: "set", + Usage: "Set all config", + Action: func(cctx *cli.Context) error { + fmt.Println("Coming soon") + return nil + }, +} + +var configGetCmd = &cli.Command{ + Name: "get", + Usage: "Get all config", + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "no-comment", + Usage: "don't comment default values", + }, + &cli.BoolFlag{ + Name: "no-doc", + Usage: "don't add value documentation", + }, + }, + Action: func(cctx *cli.Context) error { + fmt.Println("Coming soon") + return nil + }, +} diff --git a/cmd/lotus-provider/main.go b/cmd/lotus-provider/main.go index da8e474b5..8e8be00db 100644 --- a/cmd/lotus-provider/main.go +++ b/cmd/lotus-provider/main.go @@ -25,7 +25,7 @@ func main() { //initCmd, runCmd, stopCmd, - //configCmd, + configCmd, //backupCmd, //lcli.WithCategory("chain", actorCmd), //lcli.WithCategory("storage", sectorsCmd), diff --git a/lib/harmony/harmonytask/harmonytask.go b/lib/harmony/harmonytask/harmonytask.go index ace778b9b..40439a146 100644 --- a/lib/harmony/harmonytask/harmonytask.go +++ b/lib/harmony/harmonytask/harmonytask.go @@ -337,7 +337,7 @@ func (e *TaskEngine) ApplyHttpHandlers(root gin.IRouter) { v := vTmp b, err := v.f(TaskID(tID), v.h.AddTask) if err != nil { - log.Error("Follow attempt failed", "error", err, "from", name, "to", v.name) + log.Errorw("Follow attempt failed", "error", err, "from", name, "to", v.name) } taskAdded = taskAdded || b } diff --git a/lib/harmony/resources/miniopencl/mini_opencl.go b/lib/harmony/resources/miniopencl/mini_opencl.go index a6bac9582..96fe0555a 100644 --- a/lib/harmony/resources/miniopencl/mini_opencl.go +++ b/lib/harmony/resources/miniopencl/mini_opencl.go @@ -61,7 +61,63 @@ func (p *Platform) GetAllDevices() ([]*Device, error) { return devices, nil } +var errorMap = map[C.cl_int]error{ + C.CL_SUCCESS: nil, + C.CL_DEVICE_NOT_FOUND: ErrDeviceNotFound, + C.CL_DEVICE_NOT_AVAILABLE: ErrDeviceNotAvailable, + C.CL_COMPILER_NOT_AVAILABLE: ErrCompilerNotAvailable, + C.CL_MEM_OBJECT_ALLOCATION_FAILURE: ErrMemObjectAllocationFailure, + C.CL_OUT_OF_RESOURCES: ErrOutOfResources, + C.CL_OUT_OF_HOST_MEMORY: ErrOutOfHostMemory, + C.CL_PROFILING_INFO_NOT_AVAILABLE: ErrProfilingInfoNotAvailable, + C.CL_MEM_COPY_OVERLAP: ErrMemCopyOverlap, + C.CL_IMAGE_FORMAT_MISMATCH: ErrImageFormatMismatch, + C.CL_IMAGE_FORMAT_NOT_SUPPORTED: ErrImageFormatNotSupported, + C.CL_BUILD_PROGRAM_FAILURE: ErrBuildProgramFailure, + C.CL_MAP_FAILURE: ErrMapFailure, + C.CL_MISALIGNED_SUB_BUFFER_OFFSET: ErrMisalignedSubBufferOffset, + C.CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: ErrExecStatusErrorForEventsInWaitList, + C.CL_INVALID_VALUE: ErrInvalidValue, + C.CL_INVALID_DEVICE_TYPE: ErrInvalidDeviceType, + C.CL_INVALID_PLATFORM: ErrInvalidPlatform, + C.CL_INVALID_DEVICE: ErrInvalidDevice, + C.CL_INVALID_CONTEXT: ErrInvalidContext, + C.CL_INVALID_QUEUE_PROPERTIES: ErrInvalidQueueProperties, + C.CL_INVALID_COMMAND_QUEUE: ErrInvalidCommandQueue, + C.CL_INVALID_HOST_PTR: ErrInvalidHostPtr, + C.CL_INVALID_MEM_OBJECT: ErrInvalidMemObject, + C.CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: ErrInvalidImageFormatDescriptor, + C.CL_INVALID_IMAGE_SIZE: ErrInvalidImageSize, + C.CL_INVALID_SAMPLER: ErrInvalidSampler, + C.CL_INVALID_BINARY: ErrInvalidBinary, + C.CL_INVALID_BUILD_OPTIONS: ErrInvalidBuildOptions, + C.CL_INVALID_PROGRAM: ErrInvalidProgram, + C.CL_INVALID_PROGRAM_EXECUTABLE: ErrInvalidProgramExecutable, + C.CL_INVALID_KERNEL_NAME: ErrInvalidKernelName, + C.CL_INVALID_KERNEL_DEFINITION: ErrInvalidKernelDefinition, + C.CL_INVALID_KERNEL: ErrInvalidKernel, + C.CL_INVALID_ARG_INDEX: ErrInvalidArgIndex, + C.CL_INVALID_ARG_VALUE: ErrInvalidArgValue, + C.CL_INVALID_ARG_SIZE: ErrInvalidArgSize, + C.CL_INVALID_KERNEL_ARGS: ErrInvalidKernelArgs, + C.CL_INVALID_WORK_DIMENSION: ErrInvalidWorkDimension, + C.CL_INVALID_WORK_GROUP_SIZE: ErrInvalidWorkGroupSize, + C.CL_INVALID_WORK_ITEM_SIZE: ErrInvalidWorkItemSize, + C.CL_INVALID_GLOBAL_OFFSET: ErrInvalidGlobalOffset, + C.CL_INVALID_EVENT_WAIT_LIST: ErrInvalidEventWaitList, + C.CL_INVALID_EVENT: ErrInvalidEvent, + C.CL_INVALID_OPERATION: ErrInvalidOperation, + C.CL_INVALID_GL_OBJECT: ErrInvalidGlObject, + C.CL_INVALID_BUFFER_SIZE: ErrInvalidBufferSize, + C.CL_INVALID_MIP_LEVEL: ErrInvalidMipLevel, + C.CL_INVALID_GLOBAL_WORK_SIZE: ErrInvalidGlobalWorkSize, + C.CL_INVALID_PROPERTY: ErrInvalidProperty, +} + func toError(code C.cl_int) error { + if err, ok := errorMap[code]; ok { + return err + } return ErrOther(code) }