Skip to main content

I want a workspace to run on FME Flow at 11pm with a user initiating it at some point within the working day.

Currently thinking of having the workspace run within an automation, which is scheduled to run daily at 11pm. User would enable the automation, workspace would run at 11pm and then trigger a second workspace which makes a http call to stop the automation. So the workspace is only run once and won’t run again until the process is repeated.

Any ideas of a better way to do this?

I did something once with a classic schedule. I had an existing inactive schedule that would run once 5 minutes after it was activated and I used a workbench to activate it, the schedule would then run the next workbench. That way I didn't have to deactivate anything.

 

Another nice thing was that I could use my first workbench to check if the schedule was already activated. This way you can run a workbench once a day even though maybe multiple people activated it. Nice for slow processes that just update a complete dataset or something like that.


The /schedules endpoint of the API supposedly offers a way to run a schedule only once at a specified time. So I guess if you put that API call in a webhook you don't need the second workspace at all.


I can’t see any API call that allows a specified time run? I looked at automations and schedules and I can only see trigger an immediate run


Like I said; supposedly (that's what the explanation says anyway). I guess you need to set start- and end-times and an interval still


What I did with my schedule is I already set it on the correct time in the schedule itself, then I just activate it with the API through what I think was an http caller. It might be good t know that this was on an old version of FME server where the capabilities of automations was still limited which is why i had to take this route.

 

In your case I would make the schedule with the correct time to start running with maybe a CRON statement and then set the schedule to run once. Set the schedule to inactive. Then use the automation to activate the schedule(or you can still use the way I did it with workbench->schedule->workbench method).

 

Edit:Oh wait i see what you mean now. You can't do it the way I wrote here. I will take a look if I can find my old schedule and workbench.


Like I said; supposedly (that's what the explanation says anyway). I guess you need to set start- and end-times and an interval still

Ah, I’ve found it now, you effectively create a new schedule or amend an existing schedule with no recurrence with a begin time of when you want it to run, and an end time that is the same. I was looking for something that would trigger an existing schedule.

Moving away from schedules, so I think an api call to trigger the automation which will then shut itself off after running once is probably cleaner for me. 

Ideally, i’d want something so that i could manually trigger an automation at a future time. Just checking that something like that didn’t already exist.


I found it, do keep in mind that this is probably an old FME rest API so watch out with copy pasting.

This is an example URL: $(FMEServerURL)/fmerest/v3/schedules/$(Repository)/$(ScheduleName)

And the body of the call:

{
"request": {
"publishedParameters": :],
"TMDirectives": {},
"NMDirectives": {
"directives": :],
"successTopics": :],
"failureTopics": :]
}
},
"workspace": "MyWorkbenchIWantToRun.fmw",
"description": "A random description",
"repository": $(Repository),
"skipUntilJobComplete": false,
"enabled": true,
"recurrence": "none",
"name": $(ScheduleName),
"end": "@Value(ScheduleDateTimeRounded)",
"interval": 30,
"category": "A Category",
"begin": "@Value(ScheduleDateTimeRounded)"
}

Content type is application/json.

You can set your start time the same as your end time


I’m still not convinced it’s the best way, but ended up creating a workspace app which performs an api call to turn the automation on, and then it switches itself off again after running at the scheduled time.

 

It was necessary to do it this way as the automation needs to run as the automation owner not the person who pushes the button (see this issue Identify the User that will run workspaces within an automation | Community ) 


Why not using the Engine assignment rules active period ? 

https://docs.safe.com/fme/html/FME-Flow/WebUI/Active-Periods.htm
 


That active period will enable a queue and run the assigned workspaces. You can then configure your workspace in your automation to be run on this specific queue.


@alexbiz - interesting idea. Could start an automation with a manual trigger and then it would sit in a queue until the time needed to run. No switching on and off needed. I will experiment 


Reply