Re: debug statefun

2020-11-11 Thread Igal Shilman
Glad to hear that it worked out!

On Wed, Nov 11, 2020 at 9:07 AM Lian Jiang  wrote:

> Just realized making autoservice class discoverable also solved "There are
> no routers defined" mentioned by Puneet. Yes, harness does test statefun
> module discovery. Thanks.
>
> On Tue, Nov 10, 2020 at 9:57 PM Tzu-Li (Gordon) Tai 
> wrote:
>
>> On Wed, Nov 11, 2020 at 1:44 PM Tzu-Li (Gordon) Tai 
>> wrote:
>>
>>> Hi Lian,
>>>
>>> Sorry, I didn't realize that the issue you were bumping into was caused
>>> by the module not being discovered.
>>> You're right, the harness utility would not help here.
>>>
>>
>> Actually, scratch this comment. The Harness utility actually would help
>> here with surfacing these module discovery issues / missing META-INF files
>> in embedded module jars.
>> When using the Harness, module discovery works exactly the same as normal
>> application submissions, loaded via the Java SPI.
>>
>> So, in general, the harness utility can be used to check:
>>
>>- Your application logic, messaging between functions, mock ingress
>>inputs, etc.
>>- Missing constructs in your application modules (e.g. missing
>>ingress / egresses, routers)
>>- Incorrect module packaging (e.g. missing module.yaml for remote
>>modules, or missing META-INF metadata files for embedded modules)
>>
>> Best,
>> Gordon
>>
>>>
>
> --
>
> Create your own email signature
> 
>


Re: debug statefun

2020-11-11 Thread Lian Jiang
Just realized making autoservice class discoverable also solved "There are
no routers defined" mentioned by Puneet. Yes, harness does test statefun
module discovery. Thanks.

On Tue, Nov 10, 2020 at 9:57 PM Tzu-Li (Gordon) Tai 
wrote:

> On Wed, Nov 11, 2020 at 1:44 PM Tzu-Li (Gordon) Tai 
> wrote:
>
>> Hi Lian,
>>
>> Sorry, I didn't realize that the issue you were bumping into was caused
>> by the module not being discovered.
>> You're right, the harness utility would not help here.
>>
>
> Actually, scratch this comment. The Harness utility actually would help
> here with surfacing these module discovery issues / missing META-INF files
> in embedded module jars.
> When using the Harness, module discovery works exactly the same as normal
> application submissions, loaded via the Java SPI.
>
> So, in general, the harness utility can be used to check:
>
>- Your application logic, messaging between functions, mock ingress
>inputs, etc.
>- Missing constructs in your application modules (e.g. missing ingress
>/ egresses, routers)
>- Incorrect module packaging (e.g. missing module.yaml for remote
>modules, or missing META-INF metadata files for embedded modules)
>
> Best,
> Gordon
>
>>

-- 

Create your own email signature



Re: debug statefun

2020-11-10 Thread Tzu-Li (Gordon) Tai
On Wed, Nov 11, 2020 at 1:44 PM Tzu-Li (Gordon) Tai 
wrote:

> Hi Lian,
>
> Sorry, I didn't realize that the issue you were bumping into was caused by
> the module not being discovered.
> You're right, the harness utility would not help here.
>

Actually, scratch this comment. The Harness utility actually would help
here with surfacing these module discovery issues / missing META-INF files
in embedded module jars.
When using the Harness, module discovery works exactly the same as normal
application submissions, loaded via the Java SPI.

So, in general, the harness utility can be used to check:

   - Your application logic, messaging between functions, mock ingress
   inputs, etc.
   - Missing constructs in your application modules (e.g. missing ingress /
   egresses, routers)
   - Incorrect module packaging (e.g. missing module.yaml for remote
   modules, or missing META-INF metadata files for embedded modules)

Best,
Gordon

>


Re: debug statefun

2020-11-10 Thread Lian Jiang
Thanks Gordon. After better understanding how autoservice work, I resolved
the issue by adding below into my build.gradle file:

annotationProcessor 'com.google.auto.service:auto-service:1.0-rc6'

Without this, the project can compile but the autoservice class cannot
be generated appropriately.

Sorry I am not clear that I am using gradle. Cheers!


On Tue, Nov 10, 2020 at 9:44 PM Tzu-Li (Gordon) Tai 
wrote:

> Hi Lian,
>
> Sorry, I didn't realize that the issue you were bumping into was caused by
> the module not being discovered.
> You're right, the harness utility would not help here.
>
> As for the module discovery problem:
>
>- Have you looked at the contents of your jar, and see that a
>META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule
>has indeed been generated by AutoService?
>- Just to rule out the obvious first: besides the
>auto-service-annotations dependency, you also have to add the auto-service
>compiler plugin, as demonstrated here:
>https://github.com/apache/flink-statefun/blob/master/pom.xml#L192
>
> Only after adding the build plugin mentioned above, the META-INF metadata
> will be generated for classes annotated with @AutoService.
>
> Please let us know if this resolves the issue for you.
>
> Cheers,
> Gordon
>
> On Wed, Nov 11, 2020 at 3:15 AM Lian Jiang  wrote:
>
>> Igal,
>>
>> I am using AutoService and I don't need to add auto-service-annotations
>> since it is provided by statefun-flink-core. Otherwise, my project cannot
>> even build. I did exactly the same as
>>
>>
>> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java
>>
>> I did below test:
>> In statefun-greeter-example project, replace greeter jar with my jar in
>> Dockerfile, running this project can NOT find my module.
>>
>> In my project, replace my jar with the greeter jar in Dockerfile, running
>> this project can find the greeter module.
>>
>> So I am really puzzled about what is wrong with my jar.
>>
>>
>>
>> Gorden,
>>
>> harness test plumbing of ingress/egress. But it may not help me debug why
>> Flink cannot discover my module. Correct?
>>
>> Thanks guys.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Nov 10, 2020 at 9:11 AM Igal Shilman  wrote:
>>
>>> Hi Lian,
>>>
>>> If you are using the statefun-sdk directly (an embedded mode) then, most
>>> likely is that you are missing a
>>> META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule
>>> file that would point to your modules class. We are using Java SPI [1]
>>> to load all the stateful functions modules at runtime.
>>> Alternatively, you can use the @AutoService annotation [2] (you will
>>> need to add a maven dependency for that [3])
>>>
>>> If you are using the remote functions deployment mode, then please make
>>> sure that your module.yaml file is present in your Dockerfile. (for example
>>> [4])
>>>
>>> Good luck,
>>> Igal.
>>>
>>> [1] https://docs.oracle.com/javase/tutorial/ext/basics/spi.html
>>> [2]
>>> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java#L30
>>> [3] https://github.com/apache/flink-statefun/blob/master/pom.xml#L85,L89
>>> [4]
>>> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-python-greeter-example/Dockerfile#L20
>>>
>>> On Tue, Nov 10, 2020 at 4:47 PM Tzu-Li (Gordon) Tai 
>>> wrote:
>>>
 Hi,

 StateFun provide's a Harness utility exactly for that, allowing you to
 test a StateFun application in the IDE / setting breakpoints etc.
 You can take a look at this example on how to use the harness:
 https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-flink-harness-example
 .

 Cheers,
 Gordon

 On Tue, Nov 10, 2020 at 5:04 AM Lian Jiang 
 wrote:

>
> Hi,
>
> I created a POC by mimicing statefun-greeter-example. However, it
> failed due to:
>
> Caused by: java.lang.IllegalStateException: There are no ingress
> defined.
> at
> org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:25)
> ~[statefun-flink-core.jar:2.2.0]
> at
> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71)
> ~[statefun-flink-core.jar:2.2.0]
> at
> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:47)
> ~[statefun-flink-core.jar:2.2.0]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[?:1.8.0_265]
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> ~[?:1.8.0_265]
> at
> 

Re: debug statefun

2020-11-10 Thread Tzu-Li (Gordon) Tai
Hi Lian,

Sorry, I didn't realize that the issue you were bumping into was caused by
the module not being discovered.
You're right, the harness utility would not help here.

As for the module discovery problem:

   - Have you looked at the contents of your jar, and see that a
   META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule
   has indeed been generated by AutoService?
   - Just to rule out the obvious first: besides the
   auto-service-annotations dependency, you also have to add the auto-service
   compiler plugin, as demonstrated here:
   https://github.com/apache/flink-statefun/blob/master/pom.xml#L192

Only after adding the build plugin mentioned above, the META-INF metadata
will be generated for classes annotated with @AutoService.

Please let us know if this resolves the issue for you.

Cheers,
Gordon

On Wed, Nov 11, 2020 at 3:15 AM Lian Jiang  wrote:

> Igal,
>
> I am using AutoService and I don't need to add auto-service-annotations
> since it is provided by statefun-flink-core. Otherwise, my project cannot
> even build. I did exactly the same as
>
>
> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java
>
> I did below test:
> In statefun-greeter-example project, replace greeter jar with my jar in
> Dockerfile, running this project can NOT find my module.
>
> In my project, replace my jar with the greeter jar in Dockerfile, running
> this project can find the greeter module.
>
> So I am really puzzled about what is wrong with my jar.
>
>
>
> Gorden,
>
> harness test plumbing of ingress/egress. But it may not help me debug why
> Flink cannot discover my module. Correct?
>
> Thanks guys.
>
>
>
>
>
>
>
>
>
> On Tue, Nov 10, 2020 at 9:11 AM Igal Shilman  wrote:
>
>> Hi Lian,
>>
>> If you are using the statefun-sdk directly (an embedded mode) then, most
>> likely is that you are missing a
>> META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule
>> file that would point to your modules class. We are using Java SPI [1] to
>> load all the stateful functions modules at runtime.
>> Alternatively, you can use the @AutoService annotation [2] (you will need
>> to add a maven dependency for that [3])
>>
>> If you are using the remote functions deployment mode, then please make
>> sure that your module.yaml file is present in your Dockerfile. (for example
>> [4])
>>
>> Good luck,
>> Igal.
>>
>> [1] https://docs.oracle.com/javase/tutorial/ext/basics/spi.html
>> [2]
>> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java#L30
>> [3] https://github.com/apache/flink-statefun/blob/master/pom.xml#L85,L89
>> [4]
>> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-python-greeter-example/Dockerfile#L20
>>
>> On Tue, Nov 10, 2020 at 4:47 PM Tzu-Li (Gordon) Tai 
>> wrote:
>>
>>> Hi,
>>>
>>> StateFun provide's a Harness utility exactly for that, allowing you to
>>> test a StateFun application in the IDE / setting breakpoints etc.
>>> You can take a look at this example on how to use the harness:
>>> https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-flink-harness-example
>>> .
>>>
>>> Cheers,
>>> Gordon
>>>
>>> On Tue, Nov 10, 2020 at 5:04 AM Lian Jiang 
>>> wrote:
>>>

 Hi,

 I created a POC by mimicing statefun-greeter-example. However, it
 failed due to:

 Caused by: java.lang.IllegalStateException: There are no ingress
 defined.
 at
 org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:25)
 ~[statefun-flink-core.jar:2.2.0]
 at
 org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71)
 ~[statefun-flink-core.jar:2.2.0]
 at
 org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:47)
 ~[statefun-flink-core.jar:2.2.0]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 ~[?:1.8.0_265]
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 ~[?:1.8.0_265]
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_265]
 at java.lang.reflect.Method.invoke(Method.java:498)
 ~[?:1.8.0_265]
 at
 org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)
 ~[flink-dist_2.12-1.11.1.jar:1.11.1]
 at
 org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
 ~[flink-dist_2.12-1.11.1.jar:1.11.1]
 at
 

Re: debug statefun

2020-11-10 Thread Puneet Kinra
Hi Gordan
I have tried the harness utility , I am getting the below error even
though @*autoservice *annotation is there in function Module .

java.lang.IllegalStateException: There are no routers defined.
at
org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:31)
at
org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71)
at org.apache.flink.statefun.flink.harness.Harness.start(Harness.java:127)
at
org.apache.flink.statefun.examples.harness.RunnerTest.run(RunnerTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)



On Tue, Nov 10, 2020 at 9:17 PM Tzu-Li (Gordon) Tai 
wrote:

> Hi,
>
> StateFun provide's a Harness utility exactly for that, allowing you to
> test a StateFun application in the IDE / setting breakpoints etc.
> You can take a look at this example on how to use the harness:
> https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-flink-harness-example
> .
>
> Cheers,
> Gordon
>
> On Tue, Nov 10, 2020 at 5:04 AM Lian Jiang  wrote:
>
>>
>> Hi,
>>
>> I created a POC by mimicing statefun-greeter-example. However, it failed
>> due to:
>>
>> Caused by: java.lang.IllegalStateException: There are no ingress defined.
>> at
>> org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:25)
>> ~[statefun-flink-core.jar:2.2.0]
>> at
>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71)
>> ~[statefun-flink-core.jar:2.2.0]
>> at
>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:47)
>> ~[statefun-flink-core.jar:2.2.0]
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> ~[?:1.8.0_265]
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> ~[?:1.8.0_265]
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> ~[?:1.8.0_265]
>> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_265]
>> at
>> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.client.program.PackagedProgramUtils.getPipelineFromProgram(PackagedProgramUtils.java:150)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:77)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.statefun.flink.launcher.StatefulFunctionsJobGraphRetriever.retrieveJobGraph(StatefulFunctionsJobGraphRetriever.java:101)
>> ~[statefun-flink-distribution.jar:2.2.0]
>> at
>> org.apache.flink.runtime.dispatcher.runner.JobDispatcherLeaderProcessFactoryFactory.createFactory(JobDispatcherLeaderProcessFactoryFactory.java:55)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunnerFactory.createDispatcherRunner(DefaultDispatcherRunnerFactory.java:51)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:194)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:216)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$0(ClusterEntrypoint.java:169)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:168)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>
>> I have confirmed that something is wrong in my application causing this
>> error. However, it is hard to spot the issue visually and a little tricky
>> to debug in IDE (e.g. intellij). For example, if I can create an
>> application in Intellij and step through statefun library code and my code,
>> it will be easier to find the root cause. Any guidance on how to set this
>> up? Appreciate any hint. Thanks!
>>
>

-- 
*Cheers *

*Puneet Kinra*

Re: debug statefun

2020-11-10 Thread Lian Jiang
Igal,

I am using AutoService and I don't need to add auto-service-annotations
since it is provided by statefun-flink-core. Otherwise, my project cannot
even build. I did exactly the same as

https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java

I did below test:
In statefun-greeter-example project, replace greeter jar with my jar in
Dockerfile, running this project can NOT find my module.

In my project, replace my jar with the greeter jar in Dockerfile, running
this project can find the greeter module.

So I am really puzzled about what is wrong with my jar.



Gorden,

harness test plumbing of ingress/egress. But it may not help me debug why
Flink cannot discover my module. Correct?

Thanks guys.









On Tue, Nov 10, 2020 at 9:11 AM Igal Shilman  wrote:

> Hi Lian,
>
> If you are using the statefun-sdk directly (an embedded mode) then, most
> likely is that you are missing a
> META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule
> file that would point to your modules class. We are using Java SPI [1] to
> load all the stateful functions modules at runtime.
> Alternatively, you can use the @AutoService annotation [2] (you will need
> to add a maven dependency for that [3])
>
> If you are using the remote functions deployment mode, then please make
> sure that your module.yaml file is present in your Dockerfile. (for example
> [4])
>
> Good luck,
> Igal.
>
> [1] https://docs.oracle.com/javase/tutorial/ext/basics/spi.html
> [2]
> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java#L30
> [3] https://github.com/apache/flink-statefun/blob/master/pom.xml#L85,L89
> [4]
> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-python-greeter-example/Dockerfile#L20
>
> On Tue, Nov 10, 2020 at 4:47 PM Tzu-Li (Gordon) Tai 
> wrote:
>
>> Hi,
>>
>> StateFun provide's a Harness utility exactly for that, allowing you to
>> test a StateFun application in the IDE / setting breakpoints etc.
>> You can take a look at this example on how to use the harness:
>> https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-flink-harness-example
>> .
>>
>> Cheers,
>> Gordon
>>
>> On Tue, Nov 10, 2020 at 5:04 AM Lian Jiang  wrote:
>>
>>>
>>> Hi,
>>>
>>> I created a POC by mimicing statefun-greeter-example. However, it failed
>>> due to:
>>>
>>> Caused by: java.lang.IllegalStateException: There are no ingress defined.
>>> at
>>> org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:25)
>>> ~[statefun-flink-core.jar:2.2.0]
>>> at
>>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71)
>>> ~[statefun-flink-core.jar:2.2.0]
>>> at
>>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:47)
>>> ~[statefun-flink-core.jar:2.2.0]
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> ~[?:1.8.0_265]
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>> ~[?:1.8.0_265]
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> ~[?:1.8.0_265]
>>> at java.lang.reflect.Method.invoke(Method.java:498)
>>> ~[?:1.8.0_265]
>>> at
>>> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)
>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>> at
>>> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>> at
>>> org.apache.flink.client.program.PackagedProgramUtils.getPipelineFromProgram(PackagedProgramUtils.java:150)
>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>> at
>>> org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:77)
>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>> at
>>> org.apache.flink.statefun.flink.launcher.StatefulFunctionsJobGraphRetriever.retrieveJobGraph(StatefulFunctionsJobGraphRetriever.java:101)
>>> ~[statefun-flink-distribution.jar:2.2.0]
>>> at
>>> org.apache.flink.runtime.dispatcher.runner.JobDispatcherLeaderProcessFactoryFactory.createFactory(JobDispatcherLeaderProcessFactoryFactory.java:55)
>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>> at
>>> org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunnerFactory.createDispatcherRunner(DefaultDispatcherRunnerFactory.java:51)
>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>> at
>>> org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:194)
>>> 

Re: debug statefun

2020-11-10 Thread Igal Shilman
Hi Lian,

If you are using the statefun-sdk directly (an embedded mode) then, most
likely is that you are missing a
META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule
file that would point to your modules class. We are using Java SPI [1] to
load all the stateful functions modules at runtime.
Alternatively, you can use the @AutoService annotation [2] (you will need
to add a maven dependency for that [3])

If you are using the remote functions deployment mode, then please make
sure that your module.yaml file is present in your Dockerfile. (for example
[4])

Good luck,
Igal.

[1] https://docs.oracle.com/javase/tutorial/ext/basics/spi.html
[2]
https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java#L30
[3] https://github.com/apache/flink-statefun/blob/master/pom.xml#L85,L89
[4]
https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-python-greeter-example/Dockerfile#L20

On Tue, Nov 10, 2020 at 4:47 PM Tzu-Li (Gordon) Tai 
wrote:

> Hi,
>
> StateFun provide's a Harness utility exactly for that, allowing you to
> test a StateFun application in the IDE / setting breakpoints etc.
> You can take a look at this example on how to use the harness:
> https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-flink-harness-example
> .
>
> Cheers,
> Gordon
>
> On Tue, Nov 10, 2020 at 5:04 AM Lian Jiang  wrote:
>
>>
>> Hi,
>>
>> I created a POC by mimicing statefun-greeter-example. However, it failed
>> due to:
>>
>> Caused by: java.lang.IllegalStateException: There are no ingress defined.
>> at
>> org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:25)
>> ~[statefun-flink-core.jar:2.2.0]
>> at
>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71)
>> ~[statefun-flink-core.jar:2.2.0]
>> at
>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:47)
>> ~[statefun-flink-core.jar:2.2.0]
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> ~[?:1.8.0_265]
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> ~[?:1.8.0_265]
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> ~[?:1.8.0_265]
>> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_265]
>> at
>> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.client.program.PackagedProgramUtils.getPipelineFromProgram(PackagedProgramUtils.java:150)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:77)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.statefun.flink.launcher.StatefulFunctionsJobGraphRetriever.retrieveJobGraph(StatefulFunctionsJobGraphRetriever.java:101)
>> ~[statefun-flink-distribution.jar:2.2.0]
>> at
>> org.apache.flink.runtime.dispatcher.runner.JobDispatcherLeaderProcessFactoryFactory.createFactory(JobDispatcherLeaderProcessFactoryFactory.java:55)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunnerFactory.createDispatcherRunner(DefaultDispatcherRunnerFactory.java:51)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:194)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:216)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$0(ClusterEntrypoint.java:169)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>> at
>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:168)
>> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>>
>> I have confirmed that something is wrong in my application causing this
>> error. However, it is hard to spot the issue visually and a little tricky
>> to debug in IDE (e.g. intellij). For example, if I can create an
>> application in Intellij and step through statefun library code and my code,
>> it will be easier to find the root cause. Any guidance on how to 

Re: debug statefun

2020-11-10 Thread Tzu-Li (Gordon) Tai
Hi,

StateFun provide's a Harness utility exactly for that, allowing you to test
a StateFun application in the IDE / setting breakpoints etc.
You can take a look at this example on how to use the harness:
https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-flink-harness-example
.

Cheers,
Gordon

On Tue, Nov 10, 2020 at 5:04 AM Lian Jiang  wrote:

>
> Hi,
>
> I created a POC by mimicing statefun-greeter-example. However, it failed
> due to:
>
> Caused by: java.lang.IllegalStateException: There are no ingress defined.
> at
> org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:25)
> ~[statefun-flink-core.jar:2.2.0]
> at
> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71)
> ~[statefun-flink-core.jar:2.2.0]
> at
> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:47)
> ~[statefun-flink-core.jar:2.2.0]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[?:1.8.0_265]
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> ~[?:1.8.0_265]
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> ~[?:1.8.0_265]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_265]
> at
> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.client.program.PackagedProgramUtils.getPipelineFromProgram(PackagedProgramUtils.java:150)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:77)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.statefun.flink.launcher.StatefulFunctionsJobGraphRetriever.retrieveJobGraph(StatefulFunctionsJobGraphRetriever.java:101)
> ~[statefun-flink-distribution.jar:2.2.0]
> at
> org.apache.flink.runtime.dispatcher.runner.JobDispatcherLeaderProcessFactoryFactory.createFactory(JobDispatcherLeaderProcessFactoryFactory.java:55)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunnerFactory.createDispatcherRunner(DefaultDispatcherRunnerFactory.java:51)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:194)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:216)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$0(ClusterEntrypoint.java:169)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
> at
> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:168)
> ~[flink-dist_2.12-1.11.1.jar:1.11.1]
>
> I have confirmed that something is wrong in my application causing this
> error. However, it is hard to spot the issue visually and a little tricky
> to debug in IDE (e.g. intellij). For example, if I can create an
> application in Intellij and step through statefun library code and my code,
> it will be easier to find the root cause. Any guidance on how to set this
> up? Appreciate any hint. Thanks!
>