Skip to content
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

Fix/sync #13

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class IridaNextJSONOutput {
try {
// validate all JSON against passed schema prior to writing
if (validate && jsonSchema != null) {
log.debug "Validating IRIDA Next output against schema ${jsonSchema.getUri()} prior to writing to ${path}"
validateJson(jsonString)
log.debug "Validation successfull against schema ${jsonSchema.getUri()} for JSON prior to writing to ${path}"
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import java.nio.file.PathMatcher
import java.net.URI

import groovy.transform.CompileStatic
import groovy.transform.Synchronized
import groovy.util.logging.Slf4j
import groovy.json.JsonOutput
import nextflow.Session
Expand Down Expand Up @@ -51,6 +52,8 @@ import nextflow.iridanext.MetadataParserJSON
@Slf4j
@CompileStatic
class IridaNextObserver implements TraceObserver {
private static final tasksLock = new Object[0]
private static final publishedFilesLock = new Object[0]

private Map<Path,Path> publishedFiles = [:]
private List<TaskRun> tasks = []
Expand Down Expand Up @@ -98,13 +101,15 @@ class IridaNextObserver implements TraceObserver {
}

@Override
@Synchronized("tasksLock")
void onProcessComplete(TaskHandler handler, TraceRecord trace) {
log.trace "onProcessComplete: ${handler.task}"
tasks << handler.task
traces << trace
}

@Override
@Synchronized("tasksLock")
void onProcessCached(TaskHandler handler, TraceRecord trace) {
log.trace "onProcessCached: ${handler.task}"
tasks << handler.task
Expand Down Expand Up @@ -217,6 +222,7 @@ class IridaNextObserver implements TraceObserver {
}

@Override
@Synchronized("publishedFilesLock")
void onFilePublish(Path destination, Path source) {
if (publishedFiles.containsKey(source)) {
throw new Exception("Error: file with source=${source} was already published")
Expand Down