Skip to content

Added has_documents as an argument for shatter-job-rows tasks#4784

Open
rparke wants to merge 1 commit intomainfrom
rp-add-queue-for-sendfiles-by-email-process-job-row
Open

Added has_documents as an argument for shatter-job-rows tasks#4784
rparke wants to merge 1 commit intomainfrom
rp-add-queue-for-sendfiles-by-email-process-job-row

Conversation

@rparke
Copy link
Copy Markdown
Contributor

@rparke rparke commented Mar 18, 2026

adds branching logic to put save-email tasks with has_documents true onto the dedicated queue for emails with files, database-tasks-documents

This needs deploying to all workers before #4795 can be deployed, otherwise workers will get called with an argument that they can't handle.

TODO:

Copy link
Copy Markdown
Contributor

@CrystalPea CrystalPea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments - will review again when there are tests 🙌🏼

@rparke rparke force-pushed the rp-add-queue-for-sendfiles-by-email-process-job-row branch from 29489a2 to 8f2b07e Compare March 26, 2026 10:10
@rparke rparke marked this pull request as ready for review March 26, 2026 17:27
rparke added a commit that referenced this pull request Mar 27, 2026
…jobs-save` and `api-worker-jobs-save-documents`

when adding the new queues and new worker types alphagov/notifications-aws#2884 we need to ensure that new workers can startup properly without any issues. This means temporarily configuring each new worker type to take tasks from existing queues, before upgrading `notifications-api` #4784 to populate, and take messages off the new queues.
(
template_type,
args_kwargs_seq,
with_file,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to split this line out and release it in a followup - you can't risk sending a shatter_job_rows call with a third argument that might be picked up by a worker that doesn't yet know about the third argument.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rparke rparke force-pushed the rp-add-queue-for-sendfiles-by-email-process-job-row branch 3 times, most recently from a26e16f to 197c1a0 Compare April 1, 2026 16:43
@rparke rparke changed the title added handling to put the save_email task on a separate queue - ten… Added has_documents as an argument for shatter-job-rows tasks Apr 1, 2026
@rparke rparke force-pushed the rp-add-queue-for-sendfiles-by-email-process-job-row branch from 197c1a0 to bd99067 Compare April 2, 2026 10:33
Copy link
Copy Markdown
Contributor

@CrystalPea CrystalPea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, this looks good - I would love to chat about naming though. I feel some of the team knowledge/process got lost along the way 😳

current_app.logger.info("Processing missing row %(job_row_number)s for job %(job_id)s", extra, extra=extra)
process_job_row(template.template_type, task_args_kwargs, str(job.service_id))
process_job_row(
template.template_type, task_args_kwargs, has_documents=False, message_group_id=str(job.service_id)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling the files documents didn't sit right with me, but I couldn't explain it well before. Now it came back to me.

We did this piece of work a few years back with @karlchillmaid where we found naming the same objects/processes differently when it's user facing, and differently in code has led to confusion and extra team effort with things like: untangling what is what, finding the right code, knowing how to write content like errors and documentation, write to users when on support etc.

So where we could, we renamed things so they are consistent between user-facing side and code side. We couldn't easily change things like repository names or database stuff, but we did change a lot of function and variable names, and had a policy to keep this consistency as much as possible going forward.

I think as the team got bigger a couple years ago, maybe this wasn't conveyed well. I will try to prepare something for the next team demo 🙌🏼 .

But yeah, I saw Rob wanted to call this arg with_documents instead of with_files, probably because that's how the new queue and the repository are named. But to the users, we always talk about files, not documents. For this reason, I would be up for us calling them files wherever possible, and that's why I tried calling the feature "Send files by email via UI" - because this is how we would present it to our users.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to change it to has_files do we need to change the queue name?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to change it, but no biggie if it can't be done - those queue names are quite cryptic anyway 😅 . I was wondering about maybe adding comments to where they are defined, to explain what each one does.

rparke added a commit that referenced this pull request Apr 2, 2026
…jobs-save` and `api-worker-jobs-save-documents`

when adding the new queues and new worker types alphagov/notifications-aws#2884 we need to ensure that new workers can startup properly without any issues. This means temporarily configuring each new worker type to take tasks from existing queues, before upgrading `notifications-api` #4784 to populate, and take messages off the new queues.
adds branching logic to put `save-email` tasks  with `has_documents` true onto the dedicated queue for emails with files, `database-tasks-documents`

This needs deploying to all workers before #4795 can be deployed, otherwise workers will get called with an argument that they can't handle.
@rparke rparke force-pushed the rp-add-queue-for-sendfiles-by-email-process-job-row branch from 45aae66 to b4ba539 Compare April 2, 2026 14:22
rparke added a commit that referenced this pull request Apr 2, 2026
…jobs-save` and `api-worker-jobs-save-documents`

when adding the new queues and new worker types alphagov/notifications-aws#2884 we need to ensure that new workers can startup properly without any issues. This means temporarily configuring each new worker type to take tasks from existing queues, before upgrading `notifications-api` #4784 to populate, and take messages off the new queues.
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.

3 participants