Skip to content

Commit ed6832c

Browse files
committed
debug testS3WorkflowPush failure
1 parent 4fffb4b commit ed6832c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/src/main/java/com/quiltdata/quiltcore/workflows/WorkflowConfig.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,15 @@ public WorkflowValidator getWorkflowValidator(String workflow) throws WorkflowEx
186186
Pattern pkgNamePattern = pkgNamePatternNode != null ? Pattern.compile(pkgNamePatternNode.asText()) : null;
187187

188188
JsonNode metadataSchemaId = workflowData.get("metadata_schema");
189+
logger.info("metadataSchemaId={}", metadataSchemaId);
189190
Validator metadataValidator = metadataSchemaId != null ? makeValidatorFromSchema(metadataSchemaId.asText()) : null;
190191

191192
JsonNode entriesSchemaId = workflowData.get("entries_schema");
193+
logger.info("entriesSchemaId={}", entriesSchemaId);
192194
Validator entriesValidator = entriesSchemaId != null ? makeValidatorFromSchema(entriesSchemaId.asText()) : null;
193195

194196
JsonNode isMessageRequiredNode = workflowData.get("is_message_required");
195-
boolean isMessageRequired = isMessageRequiredNode != null ? isMessageRequiredNode.asBoolean(false) : false;
197+
boolean isMessageRequired = isMessageRequiredNode != null && isMessageRequiredNode.asBoolean(false);
196198

197199
var dataToStore = JsonNodeFactory.instance.objectNode()
198200
.put("id", workflow.isEmpty() ? null : workflow)
@@ -225,7 +227,7 @@ private Validator makeValidatorFromSchema(String schemaId) throws ConfigurationE
225227
JsonNode schemaNode;
226228
PhysicalKey schemaEffectivePhysicalKey;
227229

228-
logger.debug("Loading schema from {}", schemaPhysicalKey);
230+
logger.info("Loading schema from {}", schemaPhysicalKey);
229231
try {
230232
var response = schemaPhysicalKey.open();
231233
schemaNode = mapper.readTree(response.inputStream);
@@ -252,6 +254,7 @@ private Validator makeValidatorFromSchema(String schemaId) throws ConfigurationE
252254
JsonSchemaOptions options = new JsonSchemaOptions()
253255
.setBaseUri("https://quiltdata.com/") // TODO: remove it; not actually used.
254256
.setDraft(draft);
257+
logger.info("Creating validator for schema {} with options {}", schema, options);
255258
Validator validator = Validator.create(schema, options);
256259

257260
info = new SchemaInfo(validator, schemaEffectivePhysicalKey);
@@ -271,9 +274,7 @@ private PhysicalKey getPhysicalKeyForSchemaId(String schemaId) throws Configurat
271274
logger.debug("Resolving schema URL: {}", schemaUrl);
272275
try {
273276
schemaPk = PhysicalKey.fromUri(new URI(schemaUrl));
274-
} catch (IllegalArgumentException e) {
275-
throw new ConfigurationException("Couldn't parse URL: " + schemaUrl, e);
276-
} catch (URISyntaxException e) {
277+
} catch (IllegalArgumentException | URISyntaxException e) {
277278
throw new ConfigurationException("Couldn't parse URL: " + schemaUrl, e);
278279
}
279280

lib/src/main/java/com/quiltdata/quiltcore/workflows/WorkflowValidator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private void validateMessage(String message) throws WorkflowException {
125125
* @return The entry for validation.
126126
*/
127127
private static Map<String, Object> entryForValidation(ObjectMapper mapper, String logicalKey, Entry entry) {
128-
logger.debug("entryForValidation: logicalKey={}, entry={}", logicalKey, entry);
128+
logger.info("entryForValidation: logicalKey={}, entry={}", logicalKey, entry);
129129
try {
130130
return Map.of(
131131
"logical_key", logicalKey,
@@ -157,6 +157,7 @@ private void validateEntries(ObjectMapper mapper, Map<String, Entry> entries) th
157157

158158
OutputUnit output = entriesValidator.validate(entriesForValidation);
159159
if (!output.getValid()) {
160+
logger.error("validateEntries: {} for validator: {}", entriesForValidation, entriesValidator);
160161
throw new WorkflowException("Package entries failed validation");
161162
}
162163
}
@@ -179,6 +180,7 @@ private void validateMetadata(ObjectMapper mapper, ObjectNode metadata) throws W
179180
try {
180181
OutputUnit output = metadataValidator.validate(mapper.treeToValue(userMeta, Object.class));
181182
if (!output.getValid()) {
183+
logger.error("validateMetadata: {} for validator: {}", userMeta, metadataValidator);
182184
throw new WorkflowException("Metadata failed validation");
183185
}
184186
} catch (JsonProcessingException e) {

0 commit comments

Comments
 (0)