Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/github.com/stretchr/…
Browse files Browse the repository at this point in the history
…testify-1.8.4
  • Loading branch information
Sharpz7 committed Sep 18, 2023
2 parents 2dc368f + 291ef41 commit 0239cdc
Show file tree
Hide file tree
Showing 199 changed files with 1,709 additions and 1,594 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: CI

on:
push:
branches:
- master
tags:
- v*
branches-ignore:
- gh-pages
pull_request:
branches-ignore:
- gh-pages
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/not-airflow-operator.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/not-python-client.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ jobs:
echo -e "### Git status" >> $GITHUB_STEP_SUMMARY
if [[ "$changed" -gt 0 ]]; then
echo -e "Generated proto files are out of date. Please run 'make proto' and commit the changes." >> $GITHUB_STEP_SUMMARY
echo -e "Generated proto files are out of date. Please run 'mage proto' and commit the changes." >> $GITHUB_STEP_SUMMARY
git status -s -uno >> $GITHUB_STEP_SUMMARY
Expand Down
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,42 @@ Note the names of the branch must follow proper docker names:

>A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.
#### Signing Off Commits

To enhance the integrity of contributions to the Armada repository, we've adopted the use of the DCO (Developer Certificate of Origin) plug-in. This means that for every commit you contribute via Pull Requests, you'll need to sign off your commits to certify that you have the right to submit it under the open source license used by this project.

**Every commit in your PRs must have a "Signed-Off" attribute.**

When committing to the repository, ensure you use the `--signoff` option with `git commit`. This will append a sign-off message at the end of the commit log to indicate that the commit has your signature.

You sign-off by adding the following to your commit messages:

```
Author: Your Name <your.name@example.com>
Date: Thu Feb 2 11:41:15 2018 -0800
This is my commit message
Signed-off-by: Your Name <your.name@example.com>
```

Notice the `Author` and `Signed-off-by` lines match. If they don't, the PR will
be rejected by the automated DCO check.

Git has a `-s` command line option to do this automatically:

git commit -s -m 'This is my commit message'

If you forgot to do this and have not yet pushed your changes to the remote
repository, you can amend your commit with the sign-off by running

git commit --amend -s

This command will modify the latest commit and add the required sign-off.

For more details checkout [DCO](https://github.com/apps/dco)


## Chat & Discussions

Sometimes, it's good to hash things out in real time.
Expand Down
2 changes: 1 addition & 1 deletion client/python/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ workflow for contributing. First time contributors can follow the guide below to
Unlike most python projects, the Armada python client contains a large quantity of generated code. This code must be
generated in order to compile and develop against the client.

From the root of the repository, run `make python`. This will generate python code needed to build
From the root of the repository, run `mage buildPython`. This will generate python code needed to build
and use the client. This command needs to be re-run anytime an API change is committed (e.g. a change to a `*.proto`
file).

Expand Down
2 changes: 1 addition & 1 deletion client/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Before beginning, ensure you have:
- Network access to fetch docker images and go dependencies.

To generate all needed code, and install the python client:
1) From the root of the repository, run `make python`
1) From the root of the repository, run `mage buildPython`
2) Install the client using `pip install client/python`. It's strongly recommended you do this inside a virtualenv.
4 changes: 2 additions & 2 deletions client/python/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Usage

Easy way:
- Ensure all protobufs files needed for the client are generated by running
`make python` from the repository root.
`mage buildPython` from the repository root.
- `tox -e docs` will create a valid virtual environment and use it to generate
documentation. The generated files will be placed under `build/jekyll/*.md`.

Manual way:
- Ensure all protobufs files needed for the client are generated by running
`make python` from the repository root.
`mage buildPython` from the repository root.
- Create a virtual environment containing all the deps listed in `tox.ini`
under `[testenv:docs]`.
- Run `poetry install -v` from inside `client/python` to install the client
Expand Down
5 changes: 2 additions & 3 deletions cmd/armada/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"fmt"
"net/http"
_ "net/http/pprof"
Expand All @@ -13,11 +12,11 @@ import (
log "github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"golang.org/x/sync/errgroup"

"github.com/armadaproject/armada/internal/armada"
"github.com/armadaproject/armada/internal/armada/configuration"
"github.com/armadaproject/armada/internal/common"
"github.com/armadaproject/armada/internal/common/armadacontext"
gateway "github.com/armadaproject/armada/internal/common/grpc"
"github.com/armadaproject/armada/internal/common/health"
"github.com/armadaproject/armada/internal/common/logging"
Expand Down Expand Up @@ -67,7 +66,7 @@ func main() {
}

// Run services within an errgroup to propagate errors between services.
g, ctx := errgroup.WithContext(context.Background())
g, ctx := armadacontext.ErrGroup(armadacontext.Background())

// Cancel the errgroup context on SIGINT and SIGTERM,
// which shuts everything down gracefully.
Expand Down
8 changes: 4 additions & 4 deletions cmd/eventsprinter/logic/logic.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package logic

import (
"context"
"fmt"
"time"

"github.com/apache/pulsar-client-go/pulsar"
"github.com/gogo/protobuf/proto"
v1 "k8s.io/api/core/v1"

"github.com/armadaproject/armada/internal/common/armadacontext"
"github.com/armadaproject/armada/internal/common/util"
"github.com/armadaproject/armada/pkg/armadaevents"
)
Expand All @@ -18,7 +18,7 @@ func PrintEvents(url, topic, subscription string, verbose bool) error {
fmt.Println("URL:", url)
fmt.Println("Topic:", topic)
fmt.Println("Subscription", subscription)
return withSetup(url, topic, subscription, func(ctx context.Context, producer pulsar.Producer, consumer pulsar.Consumer) error {
return withSetup(url, topic, subscription, func(ctx *armadacontext.Context, producer pulsar.Producer, consumer pulsar.Consumer) error {
// Number of active jobs.
numJobs := 0

Expand Down Expand Up @@ -199,7 +199,7 @@ func stripPodSpec(spec *v1.PodSpec) *v1.PodSpec {
}

// Run action with an Armada submit client and a Pulsar producer and consumer.
func withSetup(url, topic, subscription string, action func(ctx context.Context, producer pulsar.Producer, consumer pulsar.Consumer) error) error {
func withSetup(url, topic, subscription string, action func(ctx *armadacontext.Context, producer pulsar.Producer, consumer pulsar.Consumer) error) error {
pulsarClient, err := pulsar.NewClient(pulsar.ClientOptions{
URL: url,
})
Expand All @@ -225,5 +225,5 @@ func withSetup(url, topic, subscription string, action func(ctx context.Context,
}
defer consumer.Close()

return action(context.Background(), producer, consumer)
return action(armadacontext.Background(), producer, consumer)
}
4 changes: 2 additions & 2 deletions cmd/executor/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"net/http"
"os"
"os/signal"
Expand All @@ -13,6 +12,7 @@ import (
"github.com/spf13/viper"

"github.com/armadaproject/armada/internal/common"
"github.com/armadaproject/armada/internal/common/armadacontext"
"github.com/armadaproject/armada/internal/common/health"
"github.com/armadaproject/armada/internal/executor"
"github.com/armadaproject/armada/internal/executor/configuration"
Expand Down Expand Up @@ -55,7 +55,7 @@ func main() {
)
defer shutdownMetricServer()

shutdown, wg := executor.StartUp(context.Background(), logrus.NewEntry(logrus.New()), config)
shutdown, wg := executor.StartUp(armadacontext.Background(), logrus.NewEntry(logrus.New()), config)
go func() {
<-shutdownChannel
shutdown()
Expand Down
14 changes: 7 additions & 7 deletions cmd/lookoutv2/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"os"
"os/signal"
"syscall"
Expand All @@ -12,6 +11,7 @@ import (
"k8s.io/apimachinery/pkg/util/clock"

"github.com/armadaproject/armada/internal/common"
"github.com/armadaproject/armada/internal/common/armadacontext"
"github.com/armadaproject/armada/internal/common/database"
"github.com/armadaproject/armada/internal/lookoutv2"
"github.com/armadaproject/armada/internal/lookoutv2/configuration"
Expand All @@ -36,9 +36,9 @@ func init() {
pflag.Parse()
}

func makeContext() (context.Context, func()) {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
func makeContext() (*armadacontext.Context, func()) {
ctx := armadacontext.Background()
ctx, cancel := armadacontext.WithCancel(ctx)

c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
Expand All @@ -57,7 +57,7 @@ func makeContext() (context.Context, func()) {
}
}

func migrate(ctx context.Context, config configuration.LookoutV2Configuration) {
func migrate(ctx *armadacontext.Context, config configuration.LookoutV2Configuration) {
db, err := database.OpenPgxPool(config.Postgres)
if err != nil {
panic(err)
Expand All @@ -74,7 +74,7 @@ func migrate(ctx context.Context, config configuration.LookoutV2Configuration) {
}
}

func prune(ctx context.Context, config configuration.LookoutV2Configuration) {
func prune(ctx *armadacontext.Context, config configuration.LookoutV2Configuration) {
db, err := database.OpenPgxConn(config.Postgres)
if err != nil {
panic(err)
Expand All @@ -92,7 +92,7 @@ func prune(ctx context.Context, config configuration.LookoutV2Configuration) {
log.Infof("expireAfter: %v, batchSize: %v, timeout: %v",
config.PrunerConfig.ExpireAfter, config.PrunerConfig.BatchSize, config.PrunerConfig.Timeout)

ctxTimeout, cancel := context.WithTimeout(ctx, config.PrunerConfig.Timeout)
ctxTimeout, cancel := armadacontext.WithTimeout(ctx, config.PrunerConfig.Timeout)
defer cancel()
err = pruner.PruneDb(ctxTimeout, db, config.PrunerConfig.ExpireAfter, config.PrunerConfig.BatchSize, clock.RealClock{})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/scheduler/cmd/migrate_database.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package cmd

import (
"context"
"time"

"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

"github.com/armadaproject/armada/internal/common/armadacontext"
"github.com/armadaproject/armada/internal/common/database"
schedulerdb "github.com/armadaproject/armada/internal/scheduler/database"
)
Expand Down Expand Up @@ -43,7 +43,7 @@ func migrateDatabase(cmd *cobra.Command, _ []string) error {
return errors.WithMessagef(err, "Failed to connect to database")
}

ctx, cancel := context.WithTimeout(context.Background(), timeout)
ctx, cancel := armadacontext.WithTimeout(armadacontext.Background(), timeout)
defer cancel()
return schedulerdb.Migrate(ctx, db)
}
4 changes: 2 additions & 2 deletions cmd/scheduler/cmd/prune_database.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package cmd

import (
"context"
"time"

"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/util/clock"

"github.com/armadaproject/armada/internal/common/armadacontext"
"github.com/armadaproject/armada/internal/common/database"
schedulerdb "github.com/armadaproject/armada/internal/scheduler/database"
)
Expand Down Expand Up @@ -57,7 +57,7 @@ func pruneDatabase(cmd *cobra.Command, _ []string) error {
return errors.WithMessagef(err, "Failed to connect to database")
}

ctx, cancel := context.WithTimeout(context.Background(), timeout)
ctx, cancel := armadacontext.WithTimeout(armadacontext.Background(), timeout)
defer cancel()
return schedulerdb.PruneDb(ctx, db, batchSize, expireAfter, clock.RealClock{})
}
2 changes: 1 addition & 1 deletion docs/developer/manual-localdev.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mage BootstrapTools
# Compile .pb.go files from .proto files
# (only necessary after changing a .proto file).
mage proto
make dotnet
mage dotnet

# Build the Docker images containing all Armada components.
# Only the main "bundle" is needed for quickly testing Armada.
Expand Down
Loading

0 comments on commit 0239cdc

Please sign in to comment.