Skip to content

Comments

Allow publishing of IESI script executions to GCP PubSub#182

Open
BerrevoetsRobbe wants to merge 10 commits intodevelopfrom
feature/4fb0d16/allow-publishing-of-iesi-script-executions-to-gcp-pubsub
Open

Allow publishing of IESI script executions to GCP PubSub#182
BerrevoetsRobbe wants to merge 10 commits intodevelopfrom
feature/4fb0d16/allow-publishing-of-iesi-script-executions-to-gcp-pubsub

Conversation

@BerrevoetsRobbe
Copy link
Collaborator

@BerrevoetsRobbe BerrevoetsRobbe commented Aug 31, 2020

Is your feature request related to a problem? Please describe.
I want to be able to configure a GCP PubSub where IESI should publish all the run ids of scripts that have finished.

Id
4fb0d16

@BerrevoetsRobbe BerrevoetsRobbe added the enhancement New feature or request label Aug 3, 2020
@BerrevoetsRobbe BerrevoetsRobbe added this to the v0.6.0 milestone Aug 3, 2020
@BerrevoetsRobbe BerrevoetsRobbe self-assigned this Aug 24, 2020
Copy link
Contributor

@peterbillen peterbillen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add empty conf section to /core/conf/application.yml
    publishers:

    • type:
      project:
      topic:
  • remove the scriptresult object from the console output and replace the object just by the word 'scriptresult'

@peterbillen
Copy link
Contributor

@BerrevoetsRobbe How to deserialize a string to the ScriptResult object?

I am getting a nullpointer exception here

java.lang.NullPointerException
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:43)
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:38)

@peterbillen
Copy link
Contributor

Additionally, I am getting the following test errors on the branch:

[ERROR] Tests run: 16, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 44.765 s <<< FAILURE! - in io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest
[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest  Time elapsed: 2.567 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest(ComponentAttributeConfigurationTest.java:115)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest(ComponentAttributeConfigurationTest.java:115)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test  Time elapsed: 2.967 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test(ComponentAttributeConfigurationTest.java:163)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test(ComponentAttributeConfigurationTest.java:163)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test  Time elapsed: 3.038 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test(ComponentAttributeConfigurationTest.java:218)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test(ComponentAttributeConfigurationTest.java:218)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test  Time elapsed: 3.141 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "2AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test(ComponentAttributeConfigurationTest.java:273)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "2AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test(ComponentAttributeConfigurationTest.java:273)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test  Time elapsed: 2.959 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test(ComponentAttributeConfigurationTest.java:329)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test(ComponentAttributeConfigurationTest.java:329)

[INFO] Running io.metadew.iesi.metadata.configuration.component.ComponentVersionConfigurationTest

@BerrevoetsRobbe
Copy link
Collaborator Author

@BerrevoetsRobbe How to deserialize a string to the ScriptResult object?

I am getting a nullpointer exception here

java.lang.NullPointerException
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:43)
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:38)

What code are you executing? It seems that you are mapping to Metadata.class and not ScriptResult.claa

@BerrevoetsRobbe
Copy link
Collaborator Author

Additionally, I am getting the following test errors on the branch:

[ERROR] Tests run: 16, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 44.765 s <<< FAILURE! - in io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest
[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest  Time elapsed: 2.567 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest(ComponentAttributeConfigurationTest.java:115)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest(ComponentAttributeConfigurationTest.java:115)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test  Time elapsed: 2.967 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test(ComponentAttributeConfigurationTest.java:163)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test(ComponentAttributeConfigurationTest.java:163)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test  Time elapsed: 3.038 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test(ComponentAttributeConfigurationTest.java:218)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test(ComponentAttributeConfigurationTest.java:218)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test  Time elapsed: 3.141 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "2AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test(ComponentAttributeConfigurationTest.java:273)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "2AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test(ComponentAttributeConfigurationTest.java:273)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test  Time elapsed: 2.959 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test(ComponentAttributeConfigurationTest.java:329)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test(ComponentAttributeConfigurationTest.java:329)

[INFO] Running io.metadew.iesi.metadata.configuration.component.ComponentVersionConfigurationTest

Not reproducable on my machine. All tests succeed and

Additionally, I am getting the following test errors on the branch:

[ERROR] Tests run: 16, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 44.765 s <<< FAILURE! - in io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest
[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest  Time elapsed: 2.567 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest(ComponentAttributeConfigurationTest.java:115)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeDeleteTest(ComponentAttributeConfigurationTest.java:115)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test  Time elapsed: 2.967 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test(ComponentAttributeConfigurationTest.java:163)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate1Test(ComponentAttributeConfigurationTest.java:163)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test  Time elapsed: 3.038 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test(ComponentAttributeConfigurationTest.java:218)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate2Test(ComponentAttributeConfigurationTest.java:218)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test  Time elapsed: 3.141 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "2AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test(ComponentAttributeConfigurationTest.java:273)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "2AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate3Test(ComponentAttributeConfigurationTest.java:273)

[ERROR] io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test  Time elapsed: 2.959 s  <<< ERROR!
java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test(ComponentAttributeConfigurationTest.java:329)
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "1AND")
	at io.metadew.iesi.metadata.configuration.component.ComponentAttributeConfigurationTest.componentAttributeUpdate4Test(ComponentAttributeConfigurationTest.java:329)

[INFO] Running io.metadew.iesi.metadata.configuration.component.ComponentVersionConfigurationTest

Should be fixed with latests commit. Currently a H2 in-memory is used as db during unit tests, not a SQLite DB.
It seems that H2 is more resilient against than SQLite.

@peterbillen
Copy link
Contributor

peterbillen commented Sep 11, 2020

@BerrevoetsRobbe How to deserialize a string to the ScriptResult object?
I am getting a nullpointer exception here

java.lang.NullPointerException
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:43)
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:38)

What code are you executing? It seems that you are mapping to Metadata.class and not ScriptResult.claa

import com.fasterxml.jackson.databind.ObjectMapper;
import io.metadew.iesi.metadata.definition.script.result.ScriptResult;

public class Test {
    public static void main( String[] args ) {
        System.out.println("test");
        ObjectMapper objectMapper = new ObjectMapper();
            String data = "{\"metadataKey\":{\"runId\":\"0f460498-e1cd-4a2d-b914-058fbf9a8b9a\",\"processId\":-1},\"parentProcessId\":-1,\"scriptId\":\"936a185caaa266bb9cbe981e9e05cb78cd732b0b3280eb944412bb6f8f8f07af\",\"scriptName\":\"helloworld\",\"scriptVersion\":0,\"environment\":\"tutorial\",\"status\":\"SUCCESS\",\"startTimestamp\":{\"year\":2020,\"month\":\"SEPTEMBER\",\"dayOfMonth\":11,\"dayOfWeek\":\"FRIDAY\",\"dayOfYear\":255,\"monthValue\":9,\"nano\":985000000,\"hour\":13,\"minute\":29,\"second\":20,\"chronology\":{\"calendarType\":\"iso8601\",\"id\":\"ISO\"}},\"endTimestamp\":{\"year\":2020,\"month\":\"SEPTEMBER\",\"dayOfMonth\":11,\"dayOfWeek\":\"FRIDAY\",\"dayOfYear\":255,\"monthValue\":9,\"nano\":690000000,\"hour\":13,\"minute\":29,\"second\":21,\"chronology\":{\"calendarType\":\"iso8601\",\"id\":\"ISO\"}}}";
        try {
            ScriptResult scriptResult = objectMapper.readValue(data, ScriptResult.class);
            System.out.println(scriptResult);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("issue converting object");
        }
    }

}

@BerrevoetsRobbe
Copy link
Collaborator Author

@BerrevoetsRobbe How to deserialize a string to the ScriptResult object?
I am getting a nullpointer exception here

java.lang.NullPointerException
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:43)
	at io.metadew.iesi.metadata.definition.MetadataJsonComponent$Deserializer.deserialize(MetadataJsonComponent.java:38)

What code are you executing? It seems that you are mapping to Metadata.class and not ScriptResult.claa

import com.fasterxml.jackson.databind.ObjectMapper;
import io.metadew.iesi.metadata.definition.script.result.ScriptResult;

public class Test {
    public static void main( String[] args ) {
        System.out.println("test");
        ObjectMapper objectMapper = new ObjectMapper();
            String data = "{\"metadataKey\":{\"runId\":\"0f460498-e1cd-4a2d-b914-058fbf9a8b9a\",\"processId\":-1},\"parentProcessId\":-1,\"scriptId\":\"936a185caaa266bb9cbe981e9e05cb78cd732b0b3280eb944412bb6f8f8f07af\",\"scriptName\":\"helloworld\",\"scriptVersion\":0,\"environment\":\"tutorial\",\"status\":\"SUCCESS\",\"startTimestamp\":{\"year\":2020,\"month\":\"SEPTEMBER\",\"dayOfMonth\":11,\"dayOfWeek\":\"FRIDAY\",\"dayOfYear\":255,\"monthValue\":9,\"nano\":985000000,\"hour\":13,\"minute\":29,\"second\":20,\"chronology\":{\"calendarType\":\"iso8601\",\"id\":\"ISO\"}},\"endTimestamp\":{\"year\":2020,\"month\":\"SEPTEMBER\",\"dayOfMonth\":11,\"dayOfWeek\":\"FRIDAY\",\"dayOfYear\":255,\"monthValue\":9,\"nano\":690000000,\"hour\":13,\"minute\":29,\"second\":21,\"chronology\":{\"calendarType\":\"iso8601\",\"id\":\"ISO\"}}}";
        try {
            ScriptResult scriptResult = objectMapper.readValue(data, ScriptResult.class);
            System.out.println(scriptResult);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("issue converting object");
        }
    }

}

I've modified the Java object being sent to io.metadew.iesi.connection.publisher.ScriptResultDto. You can see how it's serialized/deserialized at io.metadew.iesi.connection.publisher.ScriptResultDtoService/io.metadew.iesi.connection.publisher.ScriptResultDtoServiceTest

@BerrevoetsRobbe BerrevoetsRobbe modified the milestones: v0.6.0, v0.7.0 Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants