James Thomas

Weekend Process Automation App

"hey man, sorry to bother you, but could you write a script that runs my employee id against the proxy logs API and spits out a csv of my active workstations?"

- Actual chat log from Friday

I get these requests about twice a week - and usually I'm pretty happy to lend my experience in the form of 15 minute intense scripting intervals. A large majority of requests are simple data transformations (json → csv; append/prepend filenames, etc), which often lead to 5 minutes in the chrome inspector rapidly building out a method that performs the job. I find two issues with this (and no, not the fact that I'm using the chrome inspector over a python script or something):

I never found a decent way to organize these scripts

I've got small .js files all over every machine I own (right along side the .py and .rb files that do the same jobs). I've tried to organize these in various ways, but what always happens is: I'll write a script, someone needs it yesterday, and in the process of working with it I'll save it literally at the default save location just to get it out of the way. This is 100% my fault, but if I wasn't scripting locally, I'd never face this issue.

I don't have a great way for users to run them

Alright cool, here's some .js file and if you're an engineer it might make sense, if not then I guess I'll just run the job for you now and hope you never need it ran again.

That's essentially the hand off for all of these scripts. On top of that, even as a dev it's a pain to run them, and if I need access to them programmatically or just at all in the future, it's likely I'll have lost it or won't be able to integrate it into whatever stack my app uses right now.

So

How about a web app that just does little functions? You set it up in a jsfiddle format, where people can come make their little scripts that take x number of inputs and return y number of solutions. There are two key things that separate this from just giving out jsfiddle links:

  • These little functions will all be accessible as GET/POST requests over HTTP (so hopefully I've opened up the door for like 90% of apps to access them)
  • We can share and store them both on the user level and the group level. This lets users browse through popular public functions and hopefully stop repeating common code tasks.

I'll need a few things, which I'll continue to add to this post and I create ideas and solutions:

  • Who's the target user?
  • How do I handle Auth?
  • How would users prefer to access the functions?
  • What do I name it? (So far I'm thinking Mrs. Robot)
  • What stack should I use?
    • I'm going to go with Express/React for the sake of saving time. This is a good chance to improve my boilerplate express project.
    • I do want to play with a new design framework though. Maybe foundation 6, I read that it was great earlier today.

[Saturday, 10:42PM EST] Will this work? Will it be useful? Who knows, let me go write it first.

Edit: Back

[Saturday, 10:55PM EST] Alright, Here we go folks.

..furious planning...

[Two Weekends Later, 10:55PM EST] Two Weeks later, I'm actually starting. Here's some fun pics of wireframes:

MVP!

Alright, I've finally got somethiung usable ready to go, check it out: https://lambda.wlan1.net/

I did change the name from Mrs Robot to Lambda, despite the obvious. I was going for the vibe that Jenkins gives off, but I don't think it's going to work out, or at least not without some solid artwork (anyone want to do that?).

Currently, lambdas are executed in fresh docker containers spawned by the API, soon I'll expand that to 'runners', which will handle scaling better. The code is volume mounted into the fresh container on each api call, executed, and the stdout (or more like the stderr if you're me) is returned. Execution time is roughly 3 seconds, which isn't bad considering what we've got going on here. I've managed to do a few neat things like install npm modules and use them in lambdas, which of course increased response delay by about 2 seconds or so. I encourage anyone reading this to try and break out of the container and tell me about it!. Take a look at the screenshots below for a quick idea of what the app looks like.