Skip to content

Commit

Permalink
enforce processing part of prov record
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Dec 20, 2024
1 parent 5ad436f commit 7a61c2f
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions dbs/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,23 @@ func insertParts(rec *DatasetRecord, record *Datasets) error {
record.SCRIPT_ID = scriptId

// insert processing info
if rec.Processing != "" {
if rec.Processing == "" {
return errors.New("procesing part of provenance records is empty")
}
processingId, err = GetID(tx, "processing", "processing_id", "processing", rec.Processing)
if err != nil || processingId == 0 {
processing := Processing{
PROCESSING: rec.Processing,
OS_ID: osId,
ENVIRONMENT_ID: environmentId,
SCRIPT_ID: scriptId,
}
if err = processing.Insert(tx); err != nil {
return err
}
processingId, err = GetID(tx, "processing", "processing_id", "processing", rec.Processing)
if err != nil || processingId == 0 {
processing := Processing{
PROCESSING: rec.Processing,
OS_ID: osId,
ENVIRONMENT_ID: environmentId,
SCRIPT_ID: scriptId,
}
if err = processing.Insert(tx); err != nil {
return err
}
processingId, err = GetID(tx, "processing", "processing_id", "processing", rec.Processing)
if err != nil {
return err
}
if err != nil {
return err
}
}
record.PROCESSING_ID = processingId
Expand Down

0 comments on commit 7a61c2f

Please sign in to comment.