Hey i have a question regarding the max_parallelis...
# ask-the-community
j
Hey i have a question regarding the max_parallelism option for running a workflow remotely. Even tough i configured max parellism it seems to always spin up 20 pods at a time. Anyone know whats going wrong here?
d
@Jan Fiedler is this a map task?
j
Hey David 🙂 No its a regular task within a dynamic subworkflow
d
and are you setting up
max_parallellism
in the launch plan?
j
Copy code
LaunchPlan.get_or_create(
    name="soft-energy-launchplan",
    workflow=wf,
    max_parallelism=10,
    notifications=[
        Slack(
            phases=[
                WorkflowExecutionPhase.SUCCEEDED,
                WorkflowExecutionPhase.FAILED,
                WorkflowExecutionPhase.ABORTED,
                WorkflowExecutionPhase.TIMED_OUT,
            ],
            recipients_email=["does-not-matter-what-you-put-in-here"],
        ),
    ],
)
Yes like this and it made no difference. For some reason registering this lp and exeuting it doesnt even show me the parallelism value in the ui but 0, but thats another problem 😛
s
I think
max_parallelism
value isn't being respected for tasks in a dynamic workflow. It should, however, work correctly for tasks in a simple workflow. @Eduardo Apolinario (eapolinario), is this something we need to support?
j
Ah okay this changes a lot! So for tasks in a dynamic workflow, flyteadmins configuration for
max_parallelism
is being respected? Would be really nice to control this like in a normal workflow
Okay interesting outcome of an experiment i just did. This is my simple workflow:
Copy code
from flytekit import workflow, task, dynamic, LaunchPlan, Resources, FixedRate
import time
from datetime import timedelta


@task(requests=Resources(cpu="500m", mem="500Mi"))
def say_hello(input: str):
    time.sleep(60)
    print(f"Hello {input}")


@workflow
def wf():
    counter = 50
    for i in range(counter):
        say_hello(input="World")


LaunchPlan.get_or_create(
    name="p-launchplan",
    workflow=wf,
    max_parallelism=2,
    schedule=FixedRate(duration=timedelta(minutes=3)),
)
Executing this and observing the pods in kubernetes showed that Flyte is only launching 2 pods at a time but does not wait until the pods are done. So it basically increments with 2 over time and still ends up with 50 running pods at some time. I really thought
max_parallelism
reflects the amount of RUNNING pods at a time. Is this intended or am i missing something?
s
I really thought
max_parallelism
reflects the amount of RUNNING pods at a time.
Yeah, I think it should. How's that workflow working for you? You cannot use loop in a Flyte workflow.
c
@Jan Fiedler Which command are you using to register this launch plan? In my case
flytectl register files
command is trying to execute the launch plan from the local environment itself.
j
I think i always used pyflyte register
125 Views