Page 1 of 1

Injecting Switch Backing Files

Posted: Tue Jun 21, 2016 9:34 pm
by gabrielp
Introduction
You can inject backing and configuration files from Switch itself, and process those in your flows. Those backing files can easily be converted into datasets with an XML pickup, which you can use to pull out information. This could be pretty dangerous if you set up this inject improperly, so don't try this if you don't know what you're doing.

In this example flow, I've created a system which updates an image with some general status information.

Image

Below is the result:

Image

It should update every 5 minutes or so if you check back later.

Explanation
The "Dummy Job Clock" is a simple timerFired script which I'm using to drive my Injects. Every 5 minutes, it sends a dummy job into two Injects. The two Injects pull out copies of the flow and settings backing files. The flows are counted and then that count is written to private data. The settings are parsed as a dataset where the Switch major version is saved to private data. The contents are assembled, then move into a portal for better readability. Out of the portal, the job goes into a simple script which passes a text string to a Node script which creates an image from the text string. The image is then uploaded to AWS S3, overwriting the old object.

Download
Flow: https://drive.google.com/file/d/0B9ciRz ... sp=sharing
Flow Documentation: https://www.googledrive.com/host/0B9ciR ... WlSaGZkRW8

Conclusion
Switch is very open, in more ways than one. It's a very powerful tool and it makes it possible to create some solid automation without having to deal with serious programmers. But as time goes on, I find myself using more and more of my own tools which I'm developing. Because I have these tools now, it makes something like this trivial to put together. We could all make our tools in our own little bubbles, and in some cases, we need to. But all of our collective lives would be so much easier if we worked together, on a common set of scripts and practices that we can all re-use and improve upon. We would all be in a better place if more print automation folks contributed to the open source community.

What was used
Signature generator and script: https://github.com/dominickp/switch-sig
Private data script: https://github.com/open-automation/Swit ... rivateData
Dummy job clock script: https://github.com/open-automation/DummyJobClock
Portals: https://github.com/open-automation/SwitchPortals
SwitchAWS: https://github.com/open-automation/SwitchAWS

Re: Injecting Switch Backing Files

Posted: Wed Jun 22, 2016 8:47 am
by sander
gabrielp wrote:Introduction
Conclusion
Switch is very open, in more ways than one. It's a very powerful tool and it makes it possible to create some solid automation without having to deal with serious programmers. But as time goes on, I find myself using more and more of my own tools which I'm developing. Because I have these tools now, it makes something like this trivial to put together. We could all make our tools in our own little bubbles, and in some cases, we need to. But all of our collective lives would be so much easier if we worked together, on a common set of scripts and practices that we can all re-use and improve upon. We would all be in a better place if more print automation folks contributed to the open source community.
Cool flow to show what Switch can do, the out of the box thinking is great.

I agree with the bubbles, we should not develop everything over and over again. I'll look into Github to see how it works to join with some things.

Anyone, come join irc, let's chat about how to make our jobs easier by working together!

Re: Injecting Switch Backing Files

Posted: Thu Jun 30, 2016 9:56 am
by DtM
Very interesting!

You know, I was just in the throes of writing my own timer based file injector, but the fact you've written one and have been gracious enough to let us use it will save me a lot of time!

Can I ask, did you manage to get around timeFired always firing on flow activation regardless of what the time limit is set to? That' the one thing I was trying to get my head around before I went ahead.

I wonder if would it be in everyone's best interest to maybe encumber all of these shared scripts & flows under some sort of Creative Commons license? As you said yourself, sometimes people need to add our own tweaks to otherwise pretty universal operations. By allowing people to commit amends on git etc you may well see improvements/new scripts coming into fruition.

The above is always a bit of a tricky one, as in a lot of cases the script you've written isn't yours to give away, rather that of your employer. Perhaps Enfocus could look at some sort of repository that works similarly to the App store?

I'd like to know other peoples thoughts on this as well?

Re: Injecting Switch Backing Files

Posted: Thu Jun 30, 2016 3:15 pm
by gabrielp
DtM wrote:You know, I was just in the throes of writing my own timer based file injector, but the fact you've written one and have been gracious enough to let us use it will save me a lot of time!

Can I ask, did you manage to get around timeFired always firing on flow activation regardless of what the time limit is set to? That' the one thing I was trying to get my head around before I went ahead.
I noticed this as well but it hasn't been much of an annoyance for me. I think I can find away around it by using a counter or something, then only running the script is the counter is higher than 1. I'd be happy to implement this into a future version if you'd like to open an issue so it is not forgotten: https://github.com/open-automation/DummyJobClock/issues
DtM wrote:I wonder if would it be in everyone's best interest to maybe encumber all of these shared scripts & flows under some sort of Creative Commons license? As you said yourself, sometimes people need to add our own tweaks to otherwise pretty universal operations. By allowing people to commit amends on git etc you may well see improvements/new scripts coming into fruition.
That's my vision for Open Automation. Consider contributing with us on GitHub: https://github.com/open-automation
DtM wrote: Perhaps Enfocus could look at some sort of repository that works similarly to the App store?

I'd like to know other peoples thoughts on this as well?
Word on the street Enfocus is going to allow for free apps eventually, but I don't think it will be for a while.

Re: Injecting Switch Backing Files

Posted: Thu Sep 08, 2016 6:15 pm
by colins
We've updated this flow with the following:
- Updated Dummy Job Clock to the latest version, so it no longer fires when you start and stop the flow
- Updated Portals to V3
- Replaced the stock Inject configurators with Inject light

Image

Download V2: https://drive.google.com/file/d/0B2MhMv ... sp=sharing