Is there support to dynamically create tasks or jo...
# random
d
Is there support to dynamically create tasks or jobs to process streams and perform calculations, without having to rely on code changes and deploying jars?
n
I haven't seen anything like that for jobs. Those always seem to come with an implicit rebuild/deploy requirement. Flink stateful functions seem to be much more flexible in deployment, but you lose out on some of the benefits of the datastream/table API for traditional jobs.
d
I see. What I am looking to do is to be able to provide a service that performs some aggregations on streams, but allow users to define what these calculations are. The flexibility is dampened should compilation and deployment be required.
m
Isn’t this exactly what you can achieve with SQL?
n
Doesn't changing out the sql require redeploying a job?
m
Maybe, but it would probably end up as a semantic discussion: SQL is declarative, same as “defining what calculations are”. While functionally the way you put these changes in production (e.g. stop/start a SQL job or use a Web UI/any other tool to push the calculation definitions to prod) can be different, both imho are still a deployment because you change the configuration/logic
From my experience, the primary reason why people like to avoid pipelines/deployments isn’t a functional requirement, but to bypass IT departments or IT requirements.
Curious on other opinions though :)
n
For us, it's just speed of development. If I could leave the overall job unperturbed and more quickly swap out a small portion of logic, that could be conceivably way faster than rebuilding a big complex job.
m
I think I can more quickly iterate with Table API/SQL then I can with Datastream API in general. Doing it in SQL requires me no compilation, by far the fastest
d
Also offering a "service" or platform, you may want to offer stakeholders or teams the ability to run tasks or calculatons on top of defined streams, without the platform maintainers needing to be involved or deploy said calculations.
@Martijn Visser interesting, I will look at the SQL route. I am guessing Flink allows me to connect an SQL client to create and manage my jobs?
g
we did it using our custom dags
we wrote an engine that take user input of dag like kafka source -> sql -> kafkasink and then create ddl for source and sink and views for sql operator and other custom operator
d
And you are able to dynamically kick off tasks with their own defined calculations/operators with this approach?
g
yes, sql, http lookup, custom calculation operators in the dag flow to solve custom usecases
d
How are you submitting them to Flink or making Flink aware of incoming new use-cases without needing redeploys? I have seen an article here that describes an approach using rules or configs as a separate data source and using broadcasts: https://flink.apache.org/2020/03/24/advanced-flink-application-patterns-vol.2-dynamic-updates-of-application-logic/
g
yes, we have 2 primitives, streams and operator, an operator can take n number of streams as input and output m number of streams.
chaining of streams and operator create a flink realtime pipeline