AWS Thinkbox Discussion Forums

job.SubmitDateTime doesn't seem to work

Hello, I’m trying to run the event script below. The user updates fine, the Submit Date and Time does not.

from System import DateTime
from Deadline.Scripting import *

######################################################################
## This is the function that Deadline calls to get an instance of the
## main DeadlineEventListener class.
######################################################################
def GetDeadlineEventListener():
	return MyEvent()

######################################################################
## This is the main DeadlineEventListener class for MyEvent.
######################################################################
class MyEvent (DeadlineEventListener):

	def __init__( self ):
		self.OnJobRequeuedCallback += self.OnJobRequeued
	
	def OnJobRequeued( self, job ):

		ClientUtils.LogText("\nRunning ResetSubmisionDateOnRequeue")	
				
		# Variable setup
		previousJobUser = job.JobUserName	
		previousSubmitJobTime = job.JobSubmitDateTime		
		currentUser = ClientUtils.GetDeadlineUser()
		currentTime = DateTime.Now

		ClientUtils.LogText ("  Previous job user = " + previousJobUser)	
		ClientUtils.LogText ("  Previous job submit time = " + str(previousSubmitJobTime))
		ClientUtils.LogText ("  New job user = " + currentUser)
		ClientUtils.LogText ("  New job submit time = " + str(currentTime))

		job.SubmitDateTime = currentTime
		job.JobUserName = currentUser
		RepositoryUtils.SaveJob(job)
		
		ClientUtils.LogText ("ResetSubmisionDateOnRequeue Ended \n\n")		
		
			
		return

I think this must be a bug but I’ll be happy to be proved wrong. I’m firing this event through deadline monitor on a Windows 7 machine using Deadline6 RC1.

Cheers,

Adrian

Hi Adrian,

Changing the job’s submission date/time isn’t supported. The SubmitDateTime property you’re using is actually an internal property. The property you should be using is JobSubmitDateTime, which is a read-only value. The rule of thumb is that SaveJob will only save the properties for the job that you can modify from the job properties window in the Monitor. The reason for this is to prevent users from accidentally overwriting things like the job’s state, task counts, and other values that you wouldn’t normally be able to modify from the UI.

Cheers,

  • Ryan

Hi Ryan, Thanks for the clarification. This did work in Deadline 5, it seems a little strange to take away features. Is there any way around this?

This was actually an oversight in 5 that shouldn’t have been allowed to work in the first place. The submission time was always meant to be something that’s set once when the job is submitted, like the job’s ID. Again, the rule of thumb is that if you can’t change a property from the Monitor, you shouldn’t be allowed to change it another way.

The only way around it would be to modify the job in the database directly, but that’s something we don’t support, since the internal structure of the job could always change. Out of curiosity, what’s the reasoning for needing this? Could you not just right-click on a job and resubmit it instead of requeuing it? That should give you the same results.

Also, OnJobRequeued will fire if a single task from a completed job is requeued. Would you even want to change the submission date and job user in this case?

Cheers,

  • Ryan

Hi Ryan,

The reason I want to do this is because we like to keep a clean render queue so we can use the deadline monitor as sort of a guide as to where we are at with a project. From nuke for example, we queue a job once and then only requeue from the monitor. This means we don’t get any queuing errors with shots, and also means anyone can requeue a job when necessary. By not being able to change the submit date like in v5 it means that when we requeue, other jobs that are already rendering will get bumped down the queue if they were originally submitted after the job being requeued. Yes I could resubmit, but then I’m just creating a duplicate job with exactly the same information which seems pointless and wastes space on both file server and db.

…And yes, I know about the OnJobRequeued event… I’ve posted about it… I’ve worked around it, but to be honest, upgrading to version 6 has been a real hassle as a lot of our scripts have suffered due to the upgrade. I’ve found three scripting areas which behave differently to the previous version.

Hi Adrian,

I’m sorry to hear that migrating to v6 has been such a pain. We’ve tried to carry over the behavior from v5 as much as possible, but some things (like the OnJobRequeued event) weren’t working in v5 like they should have been, so we had to fix them in c6.

For setting the job submit date though, we’re going to add a new function to the script API called RepositoryUtils.UpdateJobSubmissionDate(), which will take a job object as a parameter. It will set the submission date to the current date/time and commit it to the database. We couldn’t add it to the SaveJob function, since that can only update the job’s inner properties object, which the submission date is not a part of.

We’ll be adding this function in RC4. Hopefully this helps make the transition a little less painful.

Cheers,

  • Ryan

Thanks Ryan… That sounds great.

Hi Ryan, I Just thought I’d post a thank you. I’ve just installed the release version of Deadline 6 and the new function RepositoryUtils.UpdateJobSubmissionDate() is in there and working.

Thank you and the rest of the team very much.

Kind regards,

Adrian Oostergetel

Privacy | Site terms | Cookie preferences