-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: save dependantJobs as array of stepIds rather than job instances #30
feat: save dependantJobs as array of stepIds rather than job instances #30
Conversation
Signed-off-by: Matthias Larsen <mlarsen@gammamedia.org>
I've only looked at this briefly, but it seems like a pretty reasonable change. I'll have a more thorough look at it soon 👍 Just out of curiosity, what was the exception you were getting? Because the |
The payload of each job is a bit large, which then quickly escalates when the Workflow contains 20 - 30 jobs and I expect some of my workflows to contain a lot more than 30 jobs. |
I think there might be an issue with this PR and nested workflow functionality. A job's dependencies gets saved as |
A less invasive way might be to change |
Signed-off-by: Matthias Larsen <mlarsen@gammamedia.org>
Signed-off-by: Matthias Larsen <mlarsen@gammamedia.org>
The latest commit works and jobs are dispatched as before. Should probably add a test or two for the |
Signed-off-by: Matthias Larsen <mlarsen@gammamedia.org>
I’ll try to have a look at this during the weekend. I haven’t forgotten about this, I’m just swamped with work right now 😅 |
Totally fair, I know the feeling :D |
tests/WorkflowTest.php
Outdated
$workflow->onStepFinished($job1); | ||
|
||
assertEquals(['::job-id::'], $workflow->refresh()->finished_jobs); | ||
}); |
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 think these two tests should be the same test but using a data provider instead. Something like this (untested)
it('stores a finished job\'s id', function ($job, string $expectedJobId) {
$workflow = createWorkflow([
'job_count' => 1,
'jobs_processed' => 0,
]);
$workflow->onStepFinished($job);
assertEquals([$expectedJobId], $workflow->refresh()->finished_jobs);
})->with([
'no job id should default to class name' => [
new TestJob1(),
TestJob1::class,
],
'use existing job id' => [
(new TestJob1())->withJobId('::job-id::'),
'::job-id::',
|
]);
tests/WorkflowTest.php
Outdated
|
||
$model->onStepFinished($job); | ||
|
||
assertEquals(NestedWorkflow::class . '.' . TestJob1::class, $job->jobId); |
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 think this assertion is unnecessary because you also added another test somewhere that specifically tests for this (ids of nested jobs get namespaced properly)
The one thing I don't quite understand about this PR is that there are quite a few changes regarding the |
Oh I see you mentioned this in a previous comment. I've also been wondering for the last couple of minutes why I save the Let me see if I can fix this in the main branch so we can hopefully simplify this PR a bit |
Can you take a look at my last two comments (regarding the tests)? I think I’m going to merge this for now and refactor to using the |
Thanks a lot for the contribution! I’ll merge this for now and do a few manual tests locally before tagging a new release 👍 |
This is part of the 3.1.1 release. I had to make one additional change to not break backwards compatibility for steps that were created before this version but hadn’t run yet (cf7fea8) |
I recently started having concerns about the payload size when saving
dependantJobs
with full job payloads and today I got my first exception forworkflow_jobs.job
column being too small.Average size of the
job
column for my project while testing is almost 20kb, with jobs regularly creeping up towards 40-50kb and this is just for the small workflows/jobs in the project.This PR reduces the size of the
job
column by 85% on average for me, but upwards of 95% on my current test data.What are your thoughts on this?