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

Batch: arraySize and child jobs #6541

Merged
merged 9 commits into from
Oct 12, 2023

Conversation

rafcio19
Copy link
Contributor

@rafcio19 rafcio19 commented Jul 19, 2023

Closes #6512

@rafcio19
Copy link
Contributor Author

Technically it does satisfy requirements from #6512 but doing it on the response, rather than in the model, feels doesn't feel quite right. I originally tried with a deepcopy of the Job object but that didn't play nicely with threading.
@bblommers can you give this a once over?

@bblommers
Copy link
Collaborator

@rafcio19 If I understand the docs correctly, we should actually execute the same job x times. So the logic is quite different - it's not just the response format that needs to change.

As a potential solution:
Can we create a new ArrayJob class, that in the run-method creates x regular Jobs that execute the actual script?

Note that I haven't looked at the implementation in a while, so I don't know how feasible it is. But that's probably the most similar to how AWS behaves.

@bblommers
Copy link
Collaborator

BTW, I would be happy to have a go at the implementation, I just don't know when/if I have time in the coming days.

@rafcio19
Copy link
Contributor Author

Thanks for the tips, leave it with me for another while.

@rafcio19 rafcio19 force-pushed the feat/batch_child_jobs branch from 4951163 to 18ad5f3 Compare October 2, 2023 06:30
@oliver-helix
Copy link

Hey @rafcio19 @bblommers
Thanks so much for your hard work here. Any update since July?

@rafcio19
Copy link
Contributor Author

Hey chaps, I haven't had much time to devote to moto since the summer. If someone else wants to have a go then please do; or you could 🤞 and give me a few weeks.

@bblommers
Copy link
Collaborator

Hey @rafcio19, I just had a crack at it. Instead of an ArrayJob, I realized it was easier to just create additional regular jobs in the submit_job-method. The parent-job itself will not be executed, but has a list of child-jobs.
When describing a job that happens to have any child-jobs, we can check immediately check the status of those child-jobs - so they are no longer hardcoded to 'SUCCEEDED'.

Based on my testing, this is all in-line with how AWS behaves

@rafcio19
Copy link
Contributor Author

Go nuts @bblommers, I've had it long enough. Will try to pick up more moto issues in the near future

@bblommers bblommers force-pushed the feat/batch_child_jobs branch from a00f396 to 301d385 Compare October 12, 2023 12:06
@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Merging #6541 (301d385) into master (9767f02) will increase coverage by 0.00%.
Report is 22 commits behind head on master.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           master    #6541    +/-   ##
========================================
  Coverage   95.81%   95.82%            
========================================
  Files         821      826     +5     
  Lines       80624    81042   +418     
========================================
+ Hits        77249    77655   +406     
- Misses       3375     3387    +12     
Flag Coverage Δ
servertests 36.73% <17.77%> (-0.10%) ⬇️
unittests 95.76% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
moto/batch/models.py 90.98% <100.00%> (+0.20%) ⬆️
moto/batch/responses.py 100.00% <100.00%> (ø)
moto/batch_simple/models.py 96.29% <100.00%> (+1.05%) ⬆️

... and 27 files with indirect coverage changes

@bblommers bblommers marked this pull request as ready for review October 12, 2023 14:06
@bblommers bblommers merged commit e594430 into getmoto:master Oct 12, 2023
@bblommers bblommers added this to the 4.2.6 milestone Oct 12, 2023
@github-actions
Copy link
Contributor

This is now part of moto >= 4.2.6.dev30

@rafcio19 rafcio19 deleted the feat/batch_child_jobs branch October 18, 2023 07:21
toshyak pushed a commit to toshyak/moto that referenced this pull request Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Moto Batch Array Job Missing arrayProperties AND no child jobs created
3 participants