-
Notifications
You must be signed in to change notification settings - Fork 9
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
Persist and partition job #3
Conversation
artursouza
commented
Mar 8, 2024
•
edited
Loading
edited
- Multi-tenancy with namespace
- Partitioning for jobs to be spread across hosts
- Persist on Etcd
- GitHub workflow with testing
- Persist with Protobuf
- Handle TTL
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
cron.go
Outdated
// The type of trigger | ||
TriggerType string | ||
// The payload containg all the information for the trigger | ||
TriggerPayload []byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will convert this to Any again and use protobuf internally to save the state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you going to do this change in this PR or a follow up? I guess it wont hurt to merge since we aren't referencing the commit in dist scheduler yet, but still feel we should update it first.
Func func(context.Context) error | ||
|
||
Repeats int32 | ||
DueTime string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to add this here until we add support for each one of these. Keeping the original Rhythm only for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will want to keep this in mind then bc I believe this exists and is sent to the ScheduleJob
so it'll error during our testing once your PR is merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding it here is not enough if the cron scheduler does not handle it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm already passing it along, so if I update the scheduler to use these changes it will break and I'll have to comment out those lines in the scheduler. I mean, its def not production code, but it's still partly there and being referenced and sent along. If you want I can comment them out. Just seems like extra orchestration
nonAlphaNumerical = regexp.MustCompile("[^a-z0-9_]") | ||
) | ||
|
||
func (j Job) canonicalName() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a limit in the library. It can be in Dapr.
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
I can do it here but want to see if Josh can explain how to do it with Nix
before I bring a Makefile.
…On Fri, Mar 8, 2024 at 7:40 PM Cassie Coyle ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In cron.go
<#3 (comment)>:
> -
-var (
- nonAlphaNumerical = regexp.MustCompile("[^a-z0-9_]")
-)
-
-func (j Job) canonicalName() string {
- return strcase.ToSnake(
- nonAlphaNumerical.ReplaceAllString(
- strings.ToLower(j.Name),
- "_",
- ),
- )
+ // The type of trigger
+ TriggerType string
+ // The payload containg all the information for the trigger
+ TriggerPayload []byte
Were you going to do this change in this PR or a follow up? I guess it
wont hurt to merge since we aren't referencing the commit in dist scheduler
yet, but still feel we should update it first.
—
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA77CWJYOASCXPA3XCLSRLYXKACPAVCNFSM6AAAAABEMMAUPKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMRWGA4DIMBSGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I personally don't know Nix, and for consistency sake would prefer Makefiles. However, if he wants to take that ownership and make it easy enough for us to consume and use that's fine. |
Let me do it with a simple Makefile and Josh can convert to Nix or help us convert it. |
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
store.go
Outdated
} | ||
} | ||
} | ||
log.Printf("Exited sync for path: %s\n", prefix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to be logging this? If we need to, please pass a logger into the library and make Debug level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed. Let me delete it. I want to handle logging as a separate PR.
@artursouza btw, the tests hang for me on |
You need to run etcd first. |
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
I remember running into this as well. Can you update the
I have this pending in the PR here that I haven't circled back to yet. |
I updated my local wip branch to point to this and the scheduleJob hangs then gives context deadline exceeded:
Maybe I need to change things before trying the code changes, but that should probably error nicer? Did you run the tests and update in a branch the go mod and other changes needed in scheduler as a test for these changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running the test with ETCD I get a data race:
==================
WARNING: DATA RACE
Write at 0x00c0007ce658 by goroutine 206:
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).tryAcquire()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:111 +0x13c
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).Lock()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:72 +0x40
github.com/diagridio/go-etcd-cron.(*Cron).run.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:431 +0x530
github.com/diagridio/go-etcd-cron.(*Cron).run.func2()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:447 +0x60
Previous write at 0x00c0007ce658 by goroutine 205:
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).tryAcquire()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:111 +0x13c
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).Lock()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:72 +0x40
github.com/diagridio/go-etcd-cron.(*Cron).run.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:431 +0x530
github.com/diagridio/go-etcd-cron.(*Cron).run.func2()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:447 +0x60
Goroutine 206 (running) created at:
github.com/diagridio/go-etcd-cron.(*Cron).run()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:405 +0xe80
github.com/diagridio/go-etcd-cron.(*Cron).Start.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:342 +0x4c
Goroutine 205 (running) created at:
github.com/diagridio/go-etcd-cron.(*Cron).run()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:405 +0xe80
github.com/diagridio/go-etcd-cron.(*Cron).Start.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:342 +0x4c
==================
==================
WARNING: DATA RACE
Write at 0x00c0007ce668 by goroutine 206:
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).tryAcquire()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:123 +0x73c
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).Lock()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:72 +0x40
github.com/diagridio/go-etcd-cron.(*Cron).run.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:431 +0x530
github.com/diagridio/go-etcd-cron.(*Cron).run.func2()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:447 +0x60
Previous write at 0x00c0007ce668 by goroutine 205:
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).tryAcquire()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:123 +0x73c
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).Lock()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:72 +0x40
github.com/diagridio/go-etcd-cron.(*Cron).run.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:431 +0x530
github.com/diagridio/go-etcd-cron.(*Cron).run.func2()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:447 +0x60
Goroutine 206 (running) created at:
github.com/diagridio/go-etcd-cron.(*Cron).run()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:405 +0xe80
github.com/diagridio/go-etcd-cron.(*Cron).Start.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:342 +0x4c
Goroutine 205 (finished) created at:
github.com/diagridio/go-etcd-cron.(*Cron).run()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:405 +0xe80
github.com/diagridio/go-etcd-cron.(*Cron).Start.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:342 +0x4c
==================
==================
WARNING: DATA RACE
Write at 0x00c0007ce670 by goroutine 206:
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).Lock()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:79 +0x16c
github.com/diagridio/go-etcd-cron.(*Cron).run.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:431 +0x530
github.com/diagridio/go-etcd-cron.(*Cron).run.func2()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:447 +0x60
Previous write at 0x00c0007ce670 by goroutine 205:
go.etcd.io/etcd/client/v3/concurrency.(*Mutex).Lock()
/home/josh/go/pkg/mod/go.etcd.io/etcd/client/v3@v3.5.12/concurrency/mutex.go:79 +0x16c
github.com/diagridio/go-etcd-cron.(*Cron).run.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:431 +0x530
github.com/diagridio/go-etcd-cron.(*Cron).run.func2()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:447 +0x60
Goroutine 206 (running) created at:
github.com/diagridio/go-etcd-cron.(*Cron).run()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:405 +0xe80
github.com/diagridio/go-etcd-cron.(*Cron).Start.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:342 +0x4c
Goroutine 205 (finished) created at:
github.com/diagridio/go-etcd-cron.(*Cron).run()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:405 +0xe80
github.com/diagridio/go-etcd-cron.(*Cron).Start.func1()
/home/josh/go/src/github.com/diagridio/go-etcd-cron/cron.go:342 +0x4c
==================
testing.go:1465: race detected during execution of test
--- FAIL: TestDelayedAdd (12.00s)
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>