Is it possible to change process function code(behavior) in the running time? - apache-flink

I just want to my flink application as much as configurable. And also i want to change the behavior of the process function in the running time instead of stopping the cluster and re-deploy the jar file.
Is there any document for that? Or is it possible to inject process function code into running jar. For instance, from the web ui, i will get the process function input(as a java code) then after submitting the form, I will update the process function behavior.

You can use a BroadcastProcessFunction (or a KeyedBroadcastProcessFunction), and on the broadcast channel, communicate (in some fashion) what the process function is supposed to do.
I've seen this technique used to broadcast javascript code (to be executed by Rhino), commands in a DSL, references to a JAR file to load, etc.
It's old and not well documented, but https://github.com/alpinegizmo/flink-training-exercises/blob/master/src/main/java/com/ververica/flinktraining/solutions/datastream_java/broadcast/TaxiQuerySolution.java is an example of this approach that uses Janino to compile and execute dynamically supplied Java expressions.

Related

How to initiate Aldebaran ServiceManager?

I would like to stop and start ALTactileGesture service through ServiceManager during my app. I'm using Choregraphe and python boxes. I have tried different options to initiate ServiceManager but none of them works. Is there any way of doing this?
Edit:
I have already tried self.sm = session.service('ServiceManager') but did not work.
The idea is to stop ALTactileGesture as soon as the app has started:
(1) ServiceManager.stopService('ALTactileGesture') (see this)
and start/restart ALTactileGesture before the application ends:
(2) ServiceManager.startService('ALTactileGesture')
My question is how to reach ServiceManager so I can then use (1) and (2)?
You have to understand that the word "service" actually means two different things in NAOqi. See an explanation here:
NAOqi services (also called "modules"), that expose an API and are
registered to the ServiceDirectory. You can call them with qicli,
subscribe to their signals, etc.
systemd services, that are standalone executables packaged in an
Application Package, declared in it's manifest with a tag.
These are managed by ALServiceManager, who can start and stop them
(they will have their own process). For clarity's sake, these are
called "Executables" in this doc.
The confusion between the two is increased by the fact that a common
pattern is to write an executable whose sole purpose is to run a NAOqi
service, and sometimes to identify both with the same name (e.g. both
are called “ALFuchsiaBallTracker”).
Your problem here is that the NAOqi service ALTactileGesture is run by the executable registered under the ID ALTactileGesture-serv. So you need to do
ALServiceManager.stop("ALTactileGesture-serv")
(I just tested it, it works fine)
(edit) by the way, I'm not sure that actually stopping and starting ALTactileGesture is the best way of doing what you're trying to do (it seems a bit hacky to me), but if you want to do it that way, this is how :)
Just try this in robot shell (old style proxy connection):
$ python
import naoqi
s = naoqi.ALProxy("ALServiceManager", "localhost", 9559 )
s.stopService('ALTactileGesture')
>>> False
s.startService('ALTactileGesture')
>>> False # (a bit weird, but ...)
So I think it's not completely working, but at least you can connect to the ServiceManager as requested...

Windows Service with running some Process

I have a problem with windows service. I'd like to his level run the program in a given situation. Every minute check a certain value and if the value is to adopt "truth" is to me the program starts. Only at the moment this does not work ...
The problem is that when debugging the code executes correctly, it displays my window, but the service is run normally nothing happens ...
Link to movies about this all:
https://youtu.be/GPv5dn92BGg
You need to jump through several hoops to launch interactive applications from a service. First, the service needs to be explicitly allowed to interact with the desktop. Then the service needs to specify the correct WindowStation for it to show on.
It may be simpler to just set your child application up as a scheduled task, as these can interact with the desktop for you

Converting existing C library to have web interface

We have an existing C library (DLL / .so) that processes some data. There's a call to initialise it, then a call to give it the parameters it needs to process, and then a few calls to retrieve the different output parameters you are interested in. The initialise is then called to reset the library for the next session. We have an app built around this to easily input the data and view the results.
Now we want to take this library and make it available as a web service. We are looking for the simplest (read quickest) way to do this. As I see it, we need:
A web services framework (Apache Axis2/C looks good for existing C code)
Some way to start a process for each incoming query (not sure if Axis2 can do something like this).
So my question is : Is Axis2/C the simplest way, or is there another simple solution?
If you have an external executable you can call, how about using something like Apache with FastCGI?

Is it possible for an application to take ownership of a window from another application?

Basically, I have two applications that run sequentially (second is started by the first, and the first exits immediately after.) I'd like to pass ownership of a window the first application created to the second application. The actual contents of the window don't need to be passed along, it's just being drawn in by DirectX.
Alternatively, but less desirably, is it possible to at least disable the window closing/opening animation, so it at least looks like the desired effect is achieved?
(This is in C, using the vanilla Win32 API.)
Instead of separated application make a DLL that will be loaded by the first application and run within it.
I suspect that you're going to run into problems because the WindowProc function is located in the memory address space of the program that you're closing.
Also, a quick look at the second remark at the bottom of the documentation for RegisterClass doesn't seem to offer up much hope.
The only work around that I can suggest for what you've described is to not close the first application until the second application is finished with the window in question.
you can use API hooking to make your DLL capture API windows calls sent by the application window and respond as if your DLL is the windows DLL
for more information about hooking check :
Hooks Overview

Checkpointing and restarting X11 applications

I want to checkpoint and restart X11 applications. I am using the BLCR (Berkeley Lab Checkpoint/Restart (BLCR)) tool.
BLCR is not able (without modifications) to reinitiate the connection to the X-Server. I used an interposition library to log all Xlib function calls with their parameters to a text file.
Now I want to be able to re-use this logged function call.
Is there a better way than to save them to a text file and parsing/interpreting them during the restart procedure?
The application which is checkpointed should redo the calls which were logged, but this seems to be not as easy as it has sounded first.
I've not tested this, but I think you might be able to solve this one by spawning an xmove child process and making sure this gets stored in the checkpoints. Your application would talk to xmove instead of the XServer directly and every time you restore from checkpoint you would "move" to the current xserver again.

Resources