AWS Thinkbox Discussion Forums

Submit Job with Opt-In event

Hi I’m very new in scripting deadline and needs some help.

  1. I made an event with OnJobSubmitted() and want to submit a job to have this event opt-in.
    How can I do that?
    Should I just set the event’s name in Job Info file (.job) like this when I create the job?
    I read this document but still not sure.
    Manual Job Submission — Deadline 10.1.23.6 documentation

EventOptIns="MyEvent"

  1. I set my event’s .param file like this to set the event to be run only at opt-in job. Is this right?

[State]
Type=Enum
Items=Global Disabled;Opt-In;Enabled

  1. How can I edit the Task’s Environment Variables or detailed info?
    I want to add one more key:value on task’s env but can’t find how to do that.

Thank you

Hello,

  1. I believe that any job that is submitted will trigger the event plugin.
    Event Plugins — Deadline 10.2.1.1 documentation
    and
    How to use opt-in event?

  2. An example .param file is shown in the above URL, but in general the State property should look more like this:

[State]
Type=Enum
Items=Global Enabled;Opt-In;Disabled
Category=Options
CategoryOrder=0
CategoryIndex=0
Label=State
Default=Opt-In
Description=How this event plug-in should respond to events. If Global, all jobs and Workers will trigger the events for this plugin. If Opt-In, jobs and Workers can choose to trigger the events for this plugin. If Disabled, no events are triggered for this plugin.

I think looking at some example code to be extremely helpful:

  1. From another thread, Justin B suggested: Setting worker process environment variables from event plugin - #7 by Justin_B

hope this helps

1 Like

Thank you for the kindest reply!
All your answers were really helpful.

I have one more question.
I want to trigger the event only when I selected a specific job that needs to do it, not in all jobs.
This is a huge problem on my event.

So I wonder if I can do that with setting the .param file’s Default to Opt-In.

Hi,

If you set the event plugin default to Opt-In, then it is up to the user to “enable” this event plugin after they submit the job (via modify job properties → Event Opt-Ins).

I thought you were going to programmatically “enable” the opt-in event plugin with a manual job submission? I personally have not done this, but it was suggested in this post How to use opt-in event? - #4 by mois.moshev
to modify the submitter to include that property under the Job Info Parameters.

thx.

Hello @ABC

Thanks for reaching out, Yes you can specify events that will trigger for the Job if the Event plugins are configured per job by adding EventOptIns in Job Info file, which should show in Event Opt-Ins wizard of Job properties once Job is submitted to Deadline Monitor.

.param file reflects the labels that are going to show for your event in UI of Deadline Monitor → configure events → Event Screen. If you want this to set Opt-In as default option then you can try passing Default=Opt-In in .param file.

Type=Enum
Items=Global Enabled;Opt-In;Disabled
Category=Options
CategoryOrder=0
Index=0
Label=State
Default=Opt-In <<<<<<<<<<<<<<<<<<<<
Description=

Do you mean specifying Environment variables for Job ? which can be added in Job info file as mentioned in doc.

Thank you so much!

Now I’m trying to edit Job Info file by using SetEnvironmentVariable('EventOptIns', 'MyEvent')

About the last question, I mean the Task’s env, not Job’s. I want to edit the detailed info of the task.
So I’m trying to add some information on a Task’s extra info using SetTaskExtraInfoKeyValue()

I don’t know if I’m doing it right.

I would like to ask one more question if possible.
How can I edit the header of Tasks table?
I want to change ‘Extra Info 0’ header to ‘My Event’ but I cannot find how.

Hello @ABC

You can change Task Extra Info values , they can be given friendly column names by navigating to Deadline Monitor → Tools → Configure Repository options → Job settings. Here is doc related to Task Extra Properties.

Refer Deadline Scripting Reference doc related to TaskProperties for more Information. Please feel free to share your script If you are getting any errors!

My guess is Environment Variables is one property of Job, Event Opt-Ins in another property of Job, by editing Job info file as you mentioned it is going to set Key, value for Environment variables of Job but it is not going to make your event shown up in Event Opt-Ins property of Job, so I think EventOptIns need to be specified as whole different property in Job info file to make it as an Opt-In for your Job.

Thank you so so much for the kindest reply!
Thanks to you, I succeed to add EventOptIns Environment Variables to a job, edited Tasks column header, made myEvent’s default setting Opt-in, added Extra Info to Tasks.

Now I’m getting really close to my final goal.

The only problem I have is that, when I want to trigger the event on a job, I need to check the event’s checkbox manually with open ‘Configure Events’ dialog cause it disabled( :stop_button:) by default even I set OnJobSubmitted classmethod on EventListener class.
If I don’t check( :ballot_box_with_check:) the checkbox, a job doesn’t trigger MyEvent.

I want to make the event checked by default because some jobs need to run the event automatically after it submitted.

I read all docs and searched forum about that but couldn’t find what I want…
Should I edit .param file’s [EventCallbacks]?
Or should I use Type=Boolean like this and set it to True when I want to trigger it?
(actually, I don’t know how can I make it as True without opening UI)

[State]
Type=Boolean
Category=Options
CategoryOrder=0
Index=0
Label=State
Default=False

My .param file is like this.

[State]
Type=Enum
Items=Global Enabled;Opt-In;Disabled
Category=Options
CategoryOrder=0
Index=0
Label=State
Default=Opt-In
Description=How this event plug-in should respond to events. If Global, all jobs and Workers will trigger the events for this plugin. If Opt-In, jobs and slaves can choose to trigger the events for this plugin. If Disabled, no events are triggered for this plugin.

# should I need to add this???
# [EventCallbacks]
# Type=Label
# Category=Options
# CategoryOrder=0
# Index=2    # I don't know why the index=2, not 1...
# Description=The Event Callbacks that this Event Plugin subscribes to.
# Default=OnJobSubmitted

Thank you so much.

Hello @ABC

I assume you are asking about event showing checked-in in the event opt-ins of job properties ? .param file represents only UI for your event and nothing to do with Job properties. In order to make your event checked-in for job you need to add event in Job Info file as mentioned before:

Ah I get it.

I already added it to Job Info file so maybe I should check if I missed something.

Thank you so much!!

1 Like
Privacy | Site terms | Cookie preferences