Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove gorm, use pgx for postgres #696

Merged
merged 25 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fdc9647
refactor: use pgx in project repo
sbchaos Dec 14, 2022
74a29c8
refactor: migrate namespace repository
sbchaos Dec 14, 2022
95c4c8d
refactor: move secret repository to pgx
sbchaos Dec 15, 2022
d005963
fix: fix lint and test issues
sbchaos Dec 15, 2022
809d47b
refactor: add foreign key for tenant in resource and job
sbchaos Dec 15, 2022
c06ea5f
refactor: use pgx for resource and backup
sbchaos Dec 15, 2022
57a6920
refactor: use pgx for job repository
sbchaos Dec 20, 2022
779744f
refactor: change repo for scheduler bc
sbchaos Dec 21, 2022
0442486
refactor: move migration command to server
sbchaos Dec 21, 2022
80cda9c
refactor: use pgx remove gorm
sbchaos Dec 21, 2022
d05d782
refactor: update tenant bounded context
sbchaos Dec 23, 2022
199ff05
refactor: update scheduler bounded context
sbchaos Dec 23, 2022
473a2ff
refactor: update resource bounded context
sbchaos Dec 23, 2022
b5a4bd6
refactor: update job bounded context
sbchaos Dec 23, 2022
d32a5fa
fix: fix lint errors
sbchaos Jan 2, 2023
f2f0a8d
fix: fix issues for field scanning
sbchaos Jan 2, 2023
e699cd7
fix: job deleted_at value is always nil issue
arinda-arif Jan 3, 2023
defa281
fix: job repository read write issues and alter job table
arinda-arif Jan 4, 2023
e469fe3
fix: add scheduler repo tests (#698)
Mryashbhardwaj Jan 4, 2023
8ef3213
fix: fix time zone to utc
Mryashbhardwaj Jan 4, 2023
591b0d7
fix: test time zone failures
Mryashbhardwaj Jan 4, 2023
534d84a
refactor: simplify job spec struct
arinda-arif Jan 4, 2023
2c98e05
fix: scheduler job repo test failures due to spec changes
arinda-arif Jan 4, 2023
c9bd3ea
feat: add 000046 migration down file
arinda-arif Jan 4, 2023
3611725
fix: inferred dependency resolution issue when duplicated job name fo…
arinda-arif Jan 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions client/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/odpf/optimus/client/cmd/extension"
"github.com/odpf/optimus/client/cmd/initialize"
"github.com/odpf/optimus/client/cmd/job"
"github.com/odpf/optimus/client/cmd/migration"
"github.com/odpf/optimus/client/cmd/namespace"
"github.com/odpf/optimus/client/cmd/playground"
"github.com/odpf/optimus/client/cmd/plugin"
Expand Down Expand Up @@ -64,7 +63,6 @@ func New() *cli.Command {
deploy.NewDeployCommand(),
initialize.NewInitializeCommand(),
job.NewJobCommand(),
migration.NewMigrationCommand(),
namespace.NewNamespaceCommand(),
project.NewProjectCommand(),
replay.NewReplayCommand(),
Expand Down
2 changes: 1 addition & 1 deletion config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ log:
# # database connection string
# dsn: postgres://user:password@localhost:5432/database?sslmode=disable
#
# max_idle_connection: 5
# min_open_connection: 5
# max_open_connection: 10

# optimus supports multiple scheduler types
Expand Down
2 changes: 1 addition & 1 deletion config/config_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Deployer struct {

type DBConfig struct {
DSN string `mapstructure:"dsn"` // data source name e.g.: postgres://user:password@host:123/database?sslmode=disable
MaxIdleConnection int `mapstructure:"max_idle_connection" default:"10"` // maximum allowed idle DB connections
MinOpenConnection int `mapstructure:"min_open_connection" default:"5"` // minimum open DB connections
MaxOpenConnection int `mapstructure:"max_open_connection" default:"20"` // maximum allowed open DB connections
}

Expand Down
2 changes: 1 addition & 1 deletion config/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (s *ConfigTestSuite) initExpectedServerConfig() {
s.expectedServerConfig.Serve.Deployer.QueueCapacity = 10
s.expectedServerConfig.Serve.DB = config.DBConfig{}
s.expectedServerConfig.Serve.DB.DSN = "postgres://user:password@localhost:5432/database?sslmode=disable"
s.expectedServerConfig.Serve.DB.MaxIdleConnection = 5
s.expectedServerConfig.Serve.DB.MinOpenConnection = 5
s.expectedServerConfig.Serve.DB.MaxOpenConnection = 10

s.expectedServerConfig.Scheduler = config.SchedulerConfig{}
Expand Down
8 changes: 5 additions & 3 deletions core/scheduler/job_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ func (i JobRunID) IsEmpty() bool {
type JobRun struct {
ID uuid.UUID

JobName JobName
Tenant tenant.Tenant

JobName JobName
Tenant tenant.Tenant
State State
StartTime time.Time
SLAAlert bool
EndTime time.Time
}

type OperatorRun struct {
Expand Down
2 changes: 1 addition & 1 deletion ext/scheduler/airflow/__lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def execute(self, context):

if len(pod_list.items) == 1:
try_numbers_match = self._try_numbers_match(context, pod_list.items[0])
final_state, result = self.handle_pod_overlap(labels, try_numbers_match, launcher, pod_list.items[0])
final_state, _, result = self.handle_pod_overlap(labels, try_numbers_match, launcher, pod_list.items[0])
else:
final_state, _, result = self.create_new_pod_for_operator(labels, launcher)

Expand Down
28 changes: 6 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
cloud.google.com/go/bigquery v1.44.0
github.com/AlecAivazis/survey/v2 v2.2.7
github.com/MakeNowJust/heredoc v1.0.0
github.com/Masterminds/sprig/v3 v3.2.2
github.com/PagerDuty/go-pagerduty v1.5.1
github.com/briandowns/spinner v1.18.0
github.com/charmbracelet/bubbles v0.13.0
Expand All @@ -25,6 +24,7 @@ require (
github.com/hashicorp/go-getter v1.6.2
github.com/hashicorp/go-hclog v0.14.1
github.com/hashicorp/go-plugin v1.4.1
github.com/jackc/pgx/v5 v5.2.0
github.com/kushsharma/parallel v0.2.1
github.com/lib/pq v1.10.4
github.com/mattn/go-isatty v0.0.16
Expand Down Expand Up @@ -57,9 +57,6 @@ require (
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/datatypes v1.0.0
gorm.io/driver/postgres v1.0.8
gorm.io/gorm v1.21.16
)

require (
Expand All @@ -68,8 +65,6 @@ require (
cloud.google.com/go/compute/metadata v0.2.1 // indirect
cloud.google.com/go/iam v0.7.0 // indirect
cloud.google.com/go/storage v1.27.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/alecthomas/chroma v0.8.2 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
Expand Down Expand Up @@ -104,21 +99,12 @@ require (
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/pgx/v4 v4.15.0 // indirect
github.com/jackc/puddle/v2 v2.1.2 // indirect
github.com/jeremywohl/flatten v1.0.1 // indirect
github.com/jhump/protoreflect v1.9.1-0.20210817181203-db1a327a393e // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.15.1 // indirect
Expand All @@ -127,16 +113,13 @@ require (
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-sqlite3 v2.0.1+incompatible // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mcuadros/go-defaults v1.2.0 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/microcosm-cc/bluemonday v1.0.6 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
Expand All @@ -149,7 +132,7 @@ require (
github.com/prometheus/common v0.30.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand All @@ -160,10 +143,11 @@ require (
github.com/yuin/goldmark-emoji v1.0.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel/metric v0.30.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/ratelimit v0.2.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.4.0 // indirect
Expand Down
Loading