Exiting terminal without loosing job
Hi Guys,
Sealy question but I'm between a hard and rock :)
I've a running method that deletes a list of records and its has been running for hrs and did place locks so other processes can't progress, and to what I can see it will still run for a few more hours, so how can I stop this process at this point without losing what already has been deleted?
If I close the terminal all records that has been deleted will roll back as it happened to before ?
Thanks
Product version: Ensemble 2014.1
Hi, you can try to call it using job:
j ##class(MSDS.Common.JobTimeStamps).deleteOldRecords()
It's already running and I want to stop or pause the current running one as attached
I don't think it's possible.
You can suspend the process, manually delete locks, run other tasks, and unsuspend the process. But that's definitely not a supported practice.
If I interpret the situation correctly, you started a (direct mode) job in a terminal session and want to stop it without loosing (i.e. avoiding a rollback) the already deleted records. I think (but not tested) a simple Ctrl + C should be do the trick. After typing "Ctrl+C" you should see
Now type TC+<Enter>. This commits the already deleted item and you can exit your terminam session with the usual Halt command. As above said, not tested but maybe some of the Gurus here can agree (or disagree) with this procedure.
Interrupt causes rollback, try this code:
Class User.Del Extends (%Persistent, %Populate) [ Final ] { ClassMethod HangBool(seconds, id) As %Boolean [ SqlProc ] { hang seconds quit $$$YES } /// do ##class(User.Del).Test() ClassMethod Test() { do ..%KillExtent() do ..Populate(10,,,,$$$NO) set start = $zh &sql(DELETE FROM Del WHERE Del_HangBool(1, id)=1) set end = $zh w "Delete took: ", end-start,! } }
Regardless of when you send the interrupt, the
^User.DelD
global would have 10 records.my short test now
USER> USER>k ^kav USER>s ^kav(1)="some", ^(2)="data..." USER>ts k ^kav(1) f h 1 TS K ^kav(1) F H 1 ^ <INTERRUPT> TL1:USER>tc USER>zw ^kav ^kav(2)="data..." USER>
shows something else... the deleted node is gone
There are OS tools that allow you disconnect from a running session like screen.
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue