Scheduler commands through node.js

This is kind of a noob question, but I’d like to know how I could write in scheduler calls into html widgets using node.js, similarly to how the active jobs app works. I have looked through the code repo, but cannot figure it out.

I’d like to start with a simple ‘scancel jobid’ call from a button.

Any guidance on how to get started with this?

Hi! Sorry for the delay. I assume this is a passenger app in which you wrote the backend server for.

If that’s the case, what you want to do is turn that button into a form that can POST requests back to the backend server. The backend server, having received a POST request to say something like /myapp/scancel can then issue CLI commands.

Not sure if that answers your question, but feel free to post again and I’ll respond.

Thanks Jeff,
I let this slip away from me, but I am revisiting it now.

I really just need to understand how to execute CLI commands through node.js in the open ondemand framework. This example is the easiest I have, where I would like to script a button which calls a scheduler command for a given task, essentially re-creating the function that exists in the activejobs app that is part of your release package.

Once I can wrap my brain around that I want to build similar functionality into dashboard widgets for accounting and usage tracking for our customers.

@jeff.ohrstrom after researching this, It seems I need a better understanding of full stack. I was really looking for the path of least resistance to build something around what has been done in OOD so that I wouldn’t have to build an entire packaged app.

If there is a simple way to invoke node.js or server side commands through the front end that requires minimal dev please let me know, however it seems to me that I will need to build an app and deploy it on OOD.

OK yea if you want to add some functionality to OnDemand itself, then you’d have to hack around on it and deploy extra files on top of ours (while also applying patches to existing files). There’s no out of the box way to just add functionality like this.

Yea it does sound like you need a whole new web stack to deploy as an OnDemand app.

Several years ago, @shawn.doughty from Tufts gave a demo during one of our OOD webinars showing a rather simple way to add menu items to OOD that execute shell commands and show the output (things like the ‘groups’ command to see a list of the groups a user belongs too). Seems to me this might be an approach you could take here. I don’t recall the specific details, but hopefully Shawn will chime in and let us know.

I realized I have the slides from that demo, so here are some screenshots:


That’s a separate web application than OnDemand, not a modified OnDemand.

If I get time sometime, I can hack together a node.js example of issuing a command through an HTTP request.

I’ve hacked together this application this morning to demonstrate how to do this in Node JS.