←back to thread

22 points ninocan | 2 comments | | HN request time: 0.441s | source

Context: I was tasked with migrating a legacy workflow system (Broadcom CA Workflow Automation) to Airflow.

There are some jobs that contain rather simple JavaScript snippets, and I was trying to design a first prototype that simply takes the JS parts and runs them in a transpiler.

In this respect, I found a couple of packages that could be leveraged: - js2py: https://github.com/PiotrDabkowski/Js2Py - mini-racer: https://github.com/bpcreech/PyMiniRacer Yet, both seem to be abandoned packages that might not be suitable for usage in production.

Therefore, I was thinking about parsing and translating Javascript's abstract syntax trees to Python. Whereas a colleague suggested I bring up an LLM pipeline.

How much of an overkill that might be? Has anyone else ever dealt with a JavaScript-to-Python migration and could share heads-ups on strategies or pitfalls to avoid?

1. LunaSea ◴[] No.43378153[source]
I would simply dockerize the Airflow tasks and keep them in JS as-is.

Then you write the short DAG description in Python but make the task executor launch the Docker containers.

And then you're done.

replies(1): >>43378556 #
2. viceconsole ◴[] No.43378556[source]
This was my immediate thought. Just because Airflow is written in Python doesn't mean the tasks you're running need to be in Python.

Separate the concerns: migrate the task orchestration to Airflow (or whatever) while keeping the actual Javascript task code largely unchanged.