220 bugfix
This commit is contained in:
@@ -50,10 +50,24 @@
|
||||
</cfquery>
|
||||
|
||||
<!--- Check operation status, do not start already started (*** consider timeout and cancelling timed out operations here) --->
|
||||
<cfquery name="local.qCheckStartedCurrentOp" result="local.result">
|
||||
select io.dt_submit, io.dt_finish, io.dt_start, io.submit_result, io.status_url
|
||||
from instance_operation io
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid('guid',arguments.instanceOperationUid)#/>
|
||||
</cfquery>
|
||||
<cfif local.qCheckStartedCurrentOp.recordCount EQ 0>
|
||||
<cfreturn representationOf(this.helper.formatMessage(
|
||||
"There is no configured instance operation with uid #arguments.instanceOperationUid#",
|
||||
"Instance operation not found")
|
||||
).withStatus(404)/>
|
||||
</cfif>
|
||||
|
||||
<!--- Проверяем наличие запущенных операций на данном инстансе --->
|
||||
<cfquery name="local.qCheckStarted" result="local.result">
|
||||
select io.dt_submit, io.dt_finish, io.dt_start, io.submit_result, io.status_url
|
||||
from instance_operation io
|
||||
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#local.qInstance.instance_uid#" null=#!isValid('guid',local.qInstance.instance_uid)#/>
|
||||
where io.instance_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#local.qInstance.instance_uid#" null=#!isValid('guid',local.qInstance.instance_uid)#/>
|
||||
AND left(io.submit_result,1)='2' AND io.dt_finish IS NULL
|
||||
</cfquery> <!--- <cfdump var=#local.qCheckStarted.dt_finish#/><cfabort/> --->
|
||||
|
||||
<!---
|
||||
@@ -61,21 +75,24 @@
|
||||
при этом стараемся исключить эффект дребезга или гонок - если мы пошлем две команды на выполнение одну за другой, вторая не должна запуститься
|
||||
перезапуск операции разрешен, если она зафейлилась либо явно (оркестратор ее пометил таковой) или неявно (джоб упал, не успев отметить операцию стартовавшей)
|
||||
Возможно, эту логику нужно воспроизвести на фронте
|
||||
*** Возможно, нужно сразу патчить зафейленную операцию
|
||||
*** Может быть, нужно проверять время старта?
|
||||
--->
|
||||
<cfif local.qCheckStarted.recordCount EQ 0>
|
||||
<cfreturn representationOf(this.helper.formatMessage(
|
||||
"There is no configured instance operation with uid #arguments.instanceOperationUid#",
|
||||
"Instance operation not found")
|
||||
).withStatus(404)/>
|
||||
<cfelseif left(local.qCheckStarted.submit_result,1) EQ "2" AND len(local.qCheckStarted.dt_finish) EQ 0><!--- 201 etc --->
|
||||
<cfloop query="local.qCheckStarted">
|
||||
<cfset var jobStatus = getJobStatus(local.qCheckStarted.status_url)/>
|
||||
<cfif jobStatus NEQ 'FAILED'>
|
||||
<cfif (jobStatus EQ 'FAILED') OR (jobStatus EQ 'ABORTED')>
|
||||
<cfquery name="local.qMarkFailed">
|
||||
update instance_operation
|
||||
set is_successful=false, dt_finish=CURRENT_TIMESTAMP
|
||||
where instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value=#arguments.instanceOperationUid#/>
|
||||
</cfquery>
|
||||
<cfelse>
|
||||
<cfreturn representationOf(this.helper.formatMessage(
|
||||
"There is a started operation on this instance",
|
||||
"Concurrent operations are not supported (job status: #jobStatus#)")
|
||||
).withStatus(422)/>
|
||||
</cfif>
|
||||
</cfif>
|
||||
</cfloop>
|
||||
<!--- Check CFS parameters at least for existence
|
||||
(*** would be better to check RFS but now CFS params are primary, RFS even mostly do not have is_required flag set) --->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user