-
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
Bulk rerun work orders (from start) #659
Comments
@amberrignell , tailwind component for this where employee rows are note that this requires some JS |
Possible approach:
|
|
Hey @sigu , thanks for the questions! To give a quick answer,
We'll see you in standup tomorrow so Stu can give you more details then, hope this helps in the meantime! |
Hey @amberrignell @taylordowns2000 , should the |
hey @midigofrank , who doesn't have permission? (have you created a policy for this action? sorry, i have not seen anything related to permissions in the issue.) |
Hey @taylordowns2000 , I noticed there's a check for def handle_event(
"rerun",
%{"attempt_id" => attempt_id, "run_id" => run_id},
socket
) do
if socket.assigns.can_rerun_job do
attempt_id
|> AttemptService.get_for_rerun(run_id)
|> WorkOrderService.retry_attempt_run(socket.assigns.current_user)
{:noreply, socket}
else
{:noreply,
socket
|> put_flash(:error, "You are not authorized to perform this action.")}
end
end |
Cool. For now please allow the error flash to appear as we don't have a design that explains why a user isn't able to run it. We can consider adding this later. |
Alright. Perfect |
Hey @taylordowns2000 , how would you suggest we handle failures. Let's say a single attempt fails, should we abort all the other attempts? |
hi @midigofrank , great q 😄 No, the scope of this feature ends at |
So.... sorry to be extra clear: if there is an error before you successfully enqueue those attempts with |
Hey @taylordowns2000 . That makes sense. Currently, I've wrapped all the actions (including the Oban.insert) for all the selected |
Sounds like we might need a quick call to nail this down—let's chat tomorrow! In the meantime: When you say "while still retrying" do you mean "while you're attempting to add them to Oban" or "while they are running"? Assuming the first, I think what you actually want is the Oban.multi. reducer = fn {changesets, index}, multi ->
Oban.insert_all(multi, "run_batch_#{index}", changesets)
end
runs
|> Enum.chunk_every(5_000)
|> Enum.with_index()
|> Enum.reduce(Ecto.Multi.new(), reducer)
|> Repo.transaction()
conn
|> put_status(:ok)
|> text(Enum.count(runs)) What we can chat about tomorrow is that if the user asks to enqueue 43,000 attempts, it would be nice to either have them all get enqueue or have none of them get enqueued. (We don't know and don't care if the new attempts succeed or fail as they are processed over the next several days... our job is DONE and we report back to the end user "All good... 43,000 enqueued!" as soon as they hit the queue.) |
@midigofrank , next steps here please:
|
Hey @taylordowns2000 , might you have an idea why the ** (UndefinedFunctionError) function Mimic.copy/1 is undefined (module Mimic is not available) |
I haven't seen that problem pop up for anyone yet. Please push your most recent changes to your branch (assuming you've rebased, also check that box above!) and I'll fire it up. Tests run OK for me as of this commit:
|
sure thing. Just pushed |
Eish, sorry @midigofrank , it looks ok on my machine and on circleCI. i'm not sure i'll be able to help. What OS are you using? Have you seen this issue on other Elixir projects? Maybe try |
Hey @taylordowns2000 , I'm on |
Let me try it on a different OS |
Hrmmm I'm on an M1 also. |
@taylordowns2000 , I've been able to run the tests by setting |
Yeah it does. Maybe you've got MIX_ENV set to something else by default in
your path?
…On Fri, Jun 16, 2023 at 10:06 AM Midigo Frank ***@***.***> wrote:
@taylordowns2000 <https://github.com/taylordowns2000> , I've been able to
run the tests by setting MIX_ENV=test. I thought mix test does that for
us 🤔
—
Reply to this email directly, view it on GitHub
<#659 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCUBLK4X2OWNB3WFG4CZNDXLQOYRANCNFSM6AAAAAAVEN55UU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Aha, you're right. I made a copy of the |
Hey @taylordowns2000 , all tests are passing except for one I've added for the liveview page. This only happens when I have the could not checkout the connection owned by #PID<0.1124.0> EDIT: ** (EXIT from #PID<0.1124.0>) an exception was raised:
** (RuntimeError) ChildProcess task exited without a value:
{%DBConnection.ConnectionError{message: "could not checkout the connection owned by #PID<0.1124.0>. When using the sandbox, connections are shared, so this may imply another process is using a connection. Reason: connection not available and request was dropped from queue after 510ms. You can configure how long requests wait in the queue using :queue_target and :queue_interval. See DBConnection.start_link/2 for more information", severity: :error, reason: :queue_timeout}, [{Ecto.Adapters.SQL, :raise_sql_call_error, 1, [file: 'lib/ecto/adapters/sql.ex', line: 913, error_info: %{module: Exception}]}, {Ecto.Repo.Schema, :apply, 4, [file: 'lib/ecto/repo/schema.ex', line: 756]}, {Ecto.Repo.Schema, :"-do_update/4-fun-3-", 15, [file: 'lib/ecto/repo/schema.ex', line: 459]}, {Lightning.Invocation, :update_run, 2, [file: 'lib/lightning/invocation.ex', line: 272]}, {Lightning.Pipeline.Runner.Handler, :"-start/2-fun-1-", 3, [file: 'lib/lightning/runtime/handler.ex', line: 74]}, {Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 89]}, {Task.Supervised, :reply, 4, [file: 'lib/task/supervised.ex', line: 34]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}
(lightning 0.6.3) lib/lightning/runtime/handler.ex:122: Lightning.Pipeline.Runner.Handler.wait/1
(lightning 0.6.3) lib/lightning/pipeline.ex:29: Lightning.Pipeline.process/1
|
Hey @taylordowns2000 , I found it easier to just move the implementation to "bulk mode" and leave out the Oban.insert operation from the main transaction. |
great! please convert this to a full PR (it's a "draft" right now) and request a review from me and @stuartc ! we'll take a look tomorrow AM. do you know if @sigu is joining our final call tomorrow AM? also, in prep for that call, have a look at the failed checks related to code coverage. thanks @midigofrank and speak soon |
Got it. Given his current timezone, I'm not so sure. I'll confirm with him and let you know |
User story
As a user that had a workflow which was running successfully, who then realised the logic isn't what I wanted, I would like to be able to bulk reprocess workflows, so that each workorder can be rerun with my updated logic.
Details
Allow users to select work orders from the history page
Allow users to reprocess the work orders they have selected
Using the following component, add a checkbox column to the history page.
If a user has selected some work orders, then changes the filters, their selection is lost.
Use the following modal component
A.Top-level select
Message:
You've selected the number_of_workorders_on_page work orders from page age_number of results for workorders matching the following query search_params. There are a total of number_of_workorders_matching_query work orders matching this query.
Example: You've selected the 12 work orders from page 1 of results for workorders matching the following query: received between x and y date, for workflow A, with a status of 'Failed'. There are a total of 32 work orders matching this query.
Buttons: Cancel, Rerun all work orders on this page from start, Rerun all work orders matching the query.
B.Individual work orders selected
Message:
You've selected number_of_selected_work_orders work orders to rerun from the start (first job). This will create a new attempt for these within the same work order
Example: You've selected 12 work orders to reprocess from the start (first job). This will create a new attempt for these within the same work order.
Buttons: Cancel, Rerun from start
Implementation notes
Please read through the platform-app implementation first
Write a function that can take a list of work order IDs and create a new attempt for each one, in the order in which they have been passed to the function.
Write a function that can take a query, and create a new attempt for each work order returned by the query, in the order in which they are returned.
The function rerun_run_from_start parameters would be:
source: (list of IDs, or parameters)
user: (used to add to the invocation reason)
Release notes
User acceptance criteria
The text was updated successfully, but these errors were encountered: