Skip to content

Commit

Permalink
IG-21969: Drop grpcio requirements (+CI fixes) [integ_0.10] (#652)
Browse files Browse the repository at this point in the history
* IG-21969: Drop grpcio requirements [integ_0.10]

But keep grpcio-tools requirement.

* gofmt

* Fix linter (#635)

Similar to v3io/v3io-go#132 and v3io/v3io-tsdb#564

* Fix release action

* Update versions (#637)

* Update dependencies

* Update dependencies

* tsdb bump

* Support pairs in V3IO_SESSION + override with V3IO_API and V3IO_ACCESS_KEY

---------

Co-authored-by: Gal Topper <galt@iguazio.com>
  • Loading branch information
gtopper and Gal Topper committed Sep 19, 2023
1 parent 58edea3 commit 028ff69
Show file tree
Hide file tree
Showing 19 changed files with 197 additions and 78 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ jobs:
GOPATH: ${{ github.workspace }}/go
GOARCH: amd64
GOOS: ${{ matrix.go-os }}
FRAMES_TAG: ${{ github.ref_name }}

- name: Upload binaries
uses: AButler/upload-release-assets@v2.0
with:
files: ${{ github.workspace }}/go/bin/framesd-*
files: framesd-*
repo-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impi:

$(GOPATH)/bin/golangci-lint:
@echo Installing golangci-lint...
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.27.0
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
cp ./bin/golangci-lint $(GOPATH)/bin/

.PHONY: lint
Expand Down
4 changes: 2 additions & 2 deletions backends/csv/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ such restriction.
package csv

import (
"io/ioutil"
"os"
"path"
"testing"

Expand Down Expand Up @@ -163,7 +163,7 @@ func loadTempCSV(t *testing.T, req *frames.ReadRequest) []frames.Frame {
}

func tmpCSV() (string, error) {
tmp, err := ioutil.TempFile("", "csv-test")
tmp, err := os.CreateTemp("", "csv-test")
if err != nil {
return "", err
}
Expand Down
2 changes: 2 additions & 0 deletions backends/tsdb/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ func (b *Backend) newAdapter(session *frames.Session, password string, token str

// Get underlying bytes of string for read-only purposes to avoid allocating a slice.
func getBytes(str string) []byte {
// nolint: govet
hdr := *(*reflect.StringHeader)(unsafe.Pointer(&str))
// nolint: govet
return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
Data: hdr.Data,
Len: hdr.Len,
Expand Down
26 changes: 26 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,36 @@ func SessionFromEnv() (*pb.Session, error) {
return session, nil
}

// Support var1=val1,var2=val2,... format
data = strings.TrimSpace(data)
if !strings.HasPrefix(data, "{") {
parts := strings.Split(data, ",")
newData := map[string]string{}
for _, part := range parts {
pair := strings.SplitN(part, "=", 2)
if len(pair) != 2 {
return nil, errors.Errorf("%s was not recognized as either a JSON dictionary or comma-separated value pairs", envKey)
}
newData[pair[0]] = pair[1]
}
bytes, err := json.Marshal(newData)
data = string(bytes)
if err != nil {
return nil, err
}
}

dec := json.NewDecoder(strings.NewReader(data))
if err := dec.Decode(session); err != nil {
return nil, errors.Wrapf(err, "can't read JSON from %s environment", envKey)
}

if session.Url == "" {
session.Url = os.Getenv("V3IO_API")
}
if session.Token == "" {
session.Token = os.Getenv("V3IO_ACCESS_KEY")
}

return session, nil
}
5 changes: 2 additions & 3 deletions clients/py/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
googleapis-common-protos>=1.5.3
# grpcio 1.34.0 must not be used as it segfaults (1.34.1 ok).
# grpcio 1.49 raises protobuf version from 3.x to 4.x, which breaks compatibility.
# grpcio-tools 1.34.0 must not be used as it segfaults (1.34.1 ok).
# grpcio-tools 1.49 raises protobuf version from 3.x to 4.x, which breaks compatibility.
grpcio-tools>=1.30,!=1.34.0,<1.49
grpcio>=1.30,!=1.34.0,<1.49
pandas>=0.23.4
requests>=2.19.1
2 changes: 1 addition & 1 deletion cmd/framesd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# (don't forget to update the -p accordingly)


FROM golang:1.14-stretch as build
FROM golang:1.19-stretch as build

WORKDIR /frames
COPY . .
Expand Down
3 changes: 1 addition & 2 deletions cmd/framesd/framesd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
_ "net/http/pprof"
Expand Down Expand Up @@ -63,7 +62,7 @@ func main() {
log.Fatal("error: no config file given")
}

data, err := ioutil.ReadFile(config.file)
data, err := os.ReadFile(config.file)
if err != nil {
log.Fatalf("error: can't read config - %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/framulate/framulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func run(configContents string, configPath string) error {
loggerInstance, err := nucliozap.NewNuclioZapCmd("framulate", nucliozap.DebugLevel)
loggerInstance, err := nucliozap.NewNuclioZapCmd("framulate", nucliozap.DebugLevel, os.Stdout)
if err != nil {
return errors.Wrap(err, "Failed to create logger")
}
Expand Down
3 changes: 2 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/

/*Package frames provides an efficient way of moving data from various sources.
/*
Package frames provides an efficient way of moving data from various sources.
The package is composed os a HTTP web server that can serve data from various
sources and from clients in Go and in Python.
Expand Down
4 changes: 2 additions & 2 deletions framulate/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package framulate

import (
"io/ioutil"
"os"
"time"

"github.com/ghodss/yaml"
Expand Down Expand Up @@ -58,7 +58,7 @@ func NewConfigFromContentsOrPath(configContents []byte, configPath string) (*Con
return nil, errors.New("Config contents or path must be specified")
}

configContents, err = ioutil.ReadFile(configPath)
configContents, err = os.ReadFile(configPath)
if err != nil {
return nil, errors.Wrapf(err, "Failed to config file at %s", configPath)
}
Expand Down
40 changes: 31 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
module github.com/v3io/frames

go 1.14
go 1.19

require (
github.com/ghodss/yaml v1.0.0
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9
github.com/golang/protobuf v1.2.0
github.com/nuclio/errors v0.0.1
github.com/nuclio/errors v0.0.4
github.com/nuclio/logger v0.0.1
github.com/nuclio/zap v0.0.2
github.com/nuclio/zap v0.1.2
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.4.0
github.com/v3io/v3io-go v0.2.5-0.20210113095419-6c806b8d5186
github.com/v3io/v3io-tsdb v0.13.1
github.com/valyala/fasthttp v1.2.0
github.com/stretchr/testify v1.8.1
github.com/v3io/v3io-go v0.3.0
github.com/v3io/v3io-tsdb v0.14.1
github.com/valyala/fasthttp v1.44.0
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/net v0.5.0
golang.org/x/text v0.6.0
google.golang.org/grpc v1.20.0
)

require (
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/liranbg/uberzap v1.20.0-nuclio.1 // indirect
github.com/logrusorgru/aurora/v3 v3.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
zombiezen.com/go/capnproto2 v2.17.0+incompatible // indirect
)

replace (
github.com/v3io/frames => ./
github.com/v3io/v3io-go => github.com/v3io/v3io-go v0.2.5-0.20210113095419-6c806b8d5186
github.com/v3io/v3io-go => github.com/v3io/v3io-go v0.3.0
github.com/xwb1989/sqlparser => github.com/v3io/sqlparser v0.0.0-20190306105200-4d7273501871
)
Loading

0 comments on commit 028ff69

Please sign in to comment.