Merge pull request #9428 from jumpserver/pr@dev@perf_ops_job

perf: 修改 ops job 约束
pull/9430/head
老广 2 years ago committed by GitHub
commit 4462e745a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b3c3f8e65468adb0105f2cbcbb8aa3ed50066c9db439a9921932c6e2adcacec3
size 119640
oid sha256:ee001334775456ab2034f9ac1905f7a9299ff763d3d2c9d394d340b75ceffb6f
size 119830

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0c3f5102d732ffe768f0545cf9271bbba45ba4c159f0a348b518b58cbdb5f20c
size 105947
oid sha256:51dd2a03462cbc3ae08d6257dec51a867b3431bf6b0800c996847a219a11aee0
size 106203

@ -0,0 +1,19 @@
# Generated by Django 3.2.14 on 2023-02-03 08:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ops', '0025_auto_20230117_1130'),
]
operations = [
migrations.AlterField(
model_name='jobexecution',
name='job',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='executions', to='ops.job'),
),
]

@ -1,4 +1,3 @@
import datetime
import json
import logging
import os
@ -97,7 +96,7 @@ class JobExecution(JMSOrgBaseModel):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
task_id = models.UUIDField(null=True)
status = models.CharField(max_length=16, verbose_name=_('Status'), default=JobStatus.running)
job = models.ForeignKey(Job, on_delete=models.CASCADE, related_name='executions', null=True)
job = models.ForeignKey(Job, on_delete=models.SET_NULL, related_name='executions', null=True)
job_version = models.IntegerField(default=0)
parameters = models.JSONField(default=dict, verbose_name=_('Parameters'))
result = models.JSONField(blank=True, null=True, verbose_name=_('Result'))
@ -122,9 +121,10 @@ class JobExecution(JMSOrgBaseModel):
@property
def assent_result_detail(self):
if self.is_finished and not self.summary.get('error', None):
if not self.is_finished or self.summary.get('error'):
return None
result = {
"summary": self.count,
"summary": self.summary,
"detail": [],
}
for asset in self.current_job.assets.all():

Loading…
Cancel
Save