Hi all, happy Friday :slightly_smiling_face: Is th...
# flyte-support
m
Hi all, happy Friday 🙂 Is there a way to register multiple workflows with the same version using the same tasks (but with different parameters) using
register_script
of Flyte Remote object? I'm currently doing this:
Copy code
def register(
            self,
            pipeline: Workflow,
            version: str,
            schedule_config: Optional[ScheduleConfig] = None,
            labels: Optional[Dict[str, str]] = None
    ) -> Tuple[FlyteWorkflow, FlyteLaunchPlan]:
        """
        Register a Flyte pipeline and create a launch plan for scheduling.

        Args:
            pipeline (Workflow): Flyte pipeline to be registered
            schedule_config (Optional[ScheduleConfig]): configuration for scheduling the pipeline
            labels (Optional[Dict[str, str]]): labels to be added to the pipeline

        Returns:
            Tuple[FlyteWorkflow, FlyteLaunchPlan]: Tuple containing the registered workflow and launch plan
        """

        # Register workflow
        registered_workflow = self._remote.register_script(
            entity=pipeline,
            version=version,
            source_path='.',
            default_launch_plan=False,
            fast_package_options=FastPackageOptions([], copy_style='copy', show_files='show_files')
        )

        # Create Launch Plan
        lp = LaunchPlan.get_or_create(
            name=schedule_config.name,
            workflow=pipeline,
            schedule=schedule_config.schedule,
            default_inputs=schedule_config.default_inputs
        )

        # Register launch plan
        registered_launch_plan = self._remote.register_launch_plan(
            entity=lp,
            version=version
        )

        # Activate launch plan
        flytelp = self._remote.fetch_launch_plan(name=lp.name, version=version)
        self._remote.activate_launchplan(flytelp.id)

        return registered_workflow, registered_launch_plan
But if I try to do this sequentially, each workflow needs to have a different version because tasks are shared (the code of them is exactly the same) 🤔
a
Hey @mammoth-parrot-74806 nice to see you again! IMO defining multiple launch plans with varying fixed inputs should work for your use case. If the workflows differ only in their input parameters, I think you could try
@dynamic
inputs at execution time rather than creating separate workflows for each parameter set.
m
I'll definitely take a look to it, maybe I reach you again in the near future regarding this topic 🙂 Btw, we have been able to deploy our first workflows in production, thanks a lot for your help during the process!