Update tasks via API - VisualCron - Forum

Community forum

Rahn
  •  Rahn
  • Paid support Topic Starter
2010-03-22T13:53:18Z
Version 5.1.0

I have a few jobs with a bunch of tasks in them that need to have the "Timeout" properties updated.

I have a simple script to do this, but when it runs, the results aren't saving, nor are visible in the client.

Here's the C# snippet of what I'm using. (the remote server connection works fine.)

foreach (JobClass j in RemoteServer.Jobs.GetAll())
{
	Console.WriteLine("Job: " + j.Name + "\t" + j.Id);
	if (j.Name.StartsWith("EAI Tasks"))
	{
		foreach (TaskClass t in j.Tasks)
		{
			Console.WriteLine("Task: " + t.Name + "\t" + t.Id);
			if (!t.TimeOut.Use)
			{
				t.TimeOut.Use = true;
				t.TimeOut.Minutes = 3;
				t.TimeOut.Hours = 0;
				t.TimeOut.Seconds = 0;
				t.TimeOut.ConsiderError = false;
			}                        
		}
	}
}

The code runs through this no problem, but the timeout properties haven't changed when I run it again.

This is what the takes look like before and after if I just look at the properties:
? t.TimeOut
Quote:

{VisualCron.TimeOutClass}
ConsiderError: false
ddoHqdyDg: 0
fpc25CHDq: false
Hours: 0
IgGfsmw7p: 0
Minutes: 0
Seconds: 0
Tven6ZTZV: false
u8beYhl2u: 0
Use: false


? t.TimeOut (After loop.)
Quote:

{VisualCron.TimeOutClass}
ConsiderError: false
ddoHqdyDg: 0
fpc25CHDq: true
Hours: 0
IgGfsmw7p: 3
Minutes: 3
Seconds: 0
Tven6ZTZV: false
u8beYhl2u: 0
Use: true



Stopping at restarting the program, and the settings are reset.
I don't know what the "garbage" settings are, nor can I access them.

Can you see what I'm missing?

Quote:

Support
2010-03-22T13:58:23Z
About update. You seem to change objects only locally. You need to call the update function after updating.

About garbage. Where and when do you see this? I mean, you are changing the properties with your code (and the properties are OK there) - when do they become "garbage".
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2010-03-22T14:01:51Z
Ok, I see what you mean by garbage settings - we will look at this.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Rahn
  •  Rahn
  • Paid support Topic Starter
2010-03-22T14:15:08Z
I don't see an update function under the task or job.
What's the property name?
Support
2010-03-22T14:23:23Z
The update functions are in the API, not in the Task and Job definitions.

ServerObj.Jobs.Update(Job j)

or

ServerObj.Jobs.Tasks.Update(Task t)

etc
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Rahn
  •  Rahn
  • Paid support Topic Starter
2010-03-22T14:28:08Z
That was what I needed.
Everything is updated now.

Thanks
Similar Topics
Users browsing this topic
Scroll to Top