Hi everyone, I need a bit of help with deploying m...
# troubleshooting
r
Hi everyone, I need a bit of help with deploying multiple jobs from a single main function in Application mode using Flink Kubernetes Operator. As per the [documentation](https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/deployment/overview/#application-mode), it should be possible to use multiple
executeAsync()
to deploy multiple jobs from the same file. This indeed is the case when running the job locally using the CLI with something like
/bin/flink run -pym job
(I'm using PyFlink btw) and I can see multiple jobs running in the UI. However, when I try to use
FlinkDeployment
for the same job, it seems that only the first job gets submitted. The second job is never submitted although the code leading up to
executeAsync()
does get executed. Is this supposed to be the case, or have I made a mistake?
n
Hi @Raihan Sunny, I've only been developing in Kotlin, but nevertheless, in Application Mode you can technically have multiple jobs if each job is contained within its own application (I believe). A single main file won't work. Only the first one is executed because it will block the execution of subsequent jobs. So I haven't created separate main functions, I eventually migrated to a session cluster when more jobs were required (it works very nicely), but it is possible from how I understood things
Why not try a session cluster instead and completely separate the jobs? It's easier to reason about when looking at an application in any case
r
Hi, our current setup does have one job per application. Within all those jobs, we have a few different groups. So, some jobs require some other jobs and they act as an Application together. That was the main reason why we wanted to have multiple jobs created from a single file. We might give session cluster a try. But it seems like there is no JobManager and TaskManager specs in a FlinkSessionJob. Is it possible to deploy jobs within a session cluster using varying requirements (cpu, memory) for taskManagers?
n
Is it possible to deploy jobs within a session cluster using varying requirements (cpu, memory) for taskManagers?
yeah 100% I have a little local example here:
Copy code
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: basic-session-deployment-only
spec:
  image: flink:1.18
  flinkVersion: v1_18
  flinkConfiguration:
    taskmanager.numberOfTaskSlots: "3"
  serviceAccount: flink
  jobManager:
    resource:
      memory: "700m"
      cpu: 0.4
    podTemplate:
      spec:
        containers:
        - name: flink-main-container
          image: flink:1.18
  taskManager:
    resource:
      memory: "1024m"
      cpu: 0.3
    podTemplate:
      spec:
        containers:
        - name: flink-main-container
          image: flink:1.18
Above creates the cluster. Below creates a job:
Copy code
apiVersion: flink.apache.org/v1beta1
kind: FlinkSessionJob
metadata:
  name: some-job
spec:
  deploymentName: basic-session-deployment-only
  job:
    jarURI: http://host.minikube.internal:8000/some-job-1.0.0-SNAPSHOT.jar
    parallelism: 1
    upgradeMode: stateless
    args: ["--releaseVersion", "v3.0.0", "--lastRunDateTime", "firstRun"]
So, some jobs require some other jobs and they act as an Application together.
I still don't see why they need to be run sequentially tbh
r
Above creates the cluster. Below creates a job:
Well as you see there isn't any "taskManager" block in the "basic-session-deployment-only" job. From what I understand, this job will have its taskManager cpu and memory configuration inherited from the session cluster you defined above. If I want another job "basic-session-deployment-2", that would also have the taskManager configuration from the session cluster, right?
n
yes it'll have the same TM config