locked
Is there any possibility of Submitting the task before adding all the task to the Job(Partial job Submitting) RRS feed

  • Question

  • Hi

    Is there any possibility of Submitting the task before adding all the task to the Job(Partial job Submitting).


    job = scheduler.CreateJob() 
    // set job params 
     
    for (int k = 0; k < 1000; k++) { 
      task = job.CreateTask(); 
      // set task params 
      job.AddTask(task); 

    For the above case creating 1000th task may done after 1 minute. In between i would like to sumbit Task1 to Task10 without keeping the processor idle.
    Is it possible?
    If possible how to configure this?

    Thanks

    PVASN Murthy
    Tuesday, August 19, 2008 6:03 AM

Answers

  • you can mark you job as RunUntilCanceled, the job will not terminate and will wait for you to terminate it "manually"

    thanks,
    .Erez
    Thursday, August 21, 2008 7:00 AM

All replies

  • Hello,
    It is possible to add tasks to a job which has already been sumbitted.  You should be able to do it in the just the way that you are doing, but simply call "Submit" after you have only added some subset of the tasks.

    Is that not working for you?  If not please post up code and we can take a look.

    Thanks,
    Josh


    -Josh
    Wednesday, August 20, 2008 3:08 AM
    Moderator
  • Hi

    Thanks Josh for your early reply.I am able to add the tasks till the job state is Finished if job is finished i cannot add any more tasks to it.

    my requirement is that  I am adding tasks from some other process which may span for 1 -5 minutes.

    If i am creating task1 and submits the job with in 10-15 sec job is completing and i cannot add task to that job and getting the following errors

    [Microsoft.Hpc.Scheduler.Properties.SchedulerException] = {"Invalid operation:Cannot add tasks when job is in state Finished"}

    Only Jobs in the Configuring State may be Submitted.



    Is there any way to mark the job to wait for finish.


    Ex:

    My Program Starts at 10:00

    I will receives tasks at different time intervals

    Task1 at 10:00

    Task2 at 10:01

    Task3 at 10:02

    Task4 at 10:03

    1)I will create Job at 10:00

    2) Add the first task at 10:00 and i want start this task immedietly without wait till all the tasks added.

    3)I will submit this Job at 10:00. As per my existing code(whcih is default behaviour).

    4)This requires only 10 second of work and Job is coming to Finsh state at 10:00:15 secconds.

    Because of the Job is already in finish state i am not able add the remaining task to it.

    Q)Is there any way to mark the job to wait for completion.... 


    If this type of setting is there then in the job start i can mark this job to wait for completion and

    Unmark this job to wait for completion after adding all the required tasks to it.
     
    Thanks in Advance

    PVASN Murthy






    I am getting the following errors. 

    [Microsoft.Hpc.Scheduler.Properties.SchedulerException] = {"Invalid operation:Cannot add tasks when job is in state Finished"}

    Only Jobs in the Configuring State may be Submitted.

    Wednesday, August 20, 2008 5:39 AM
  • you can mark you job as RunUntilCanceled, the job will not terminate and will wait for you to terminate it "manually"

    thanks,
    .Erez
    Thursday, August 21, 2008 7:00 AM
  • Hi

    RunUntilCanceled will not terminate the Job that will work for my requirement.

    How to Close this Job from code after adding all the tasks? Is it possible through code?


    Thanks in Advance

    PVASN Murthy
    Thursday, August 21, 2008 12:49 PM
  • Once you've added all your tasks, you can set RunUntilCanceled to false.  Alternatively you can just wait for your tasks to complete and then cancel the job.
    -Josh
    Wednesday, August 27, 2008 5:54 PM
    Moderator
  • Hi Josh


    Using RunUntilCanceled i am able to submit the Tasks  before Adding all the Task. The Problem i am having here is This Job is not coming the Finish state event aftere calling job.RunUntilCanceled = false. As i am writing Event for Job Completion Event i cannot cancel this job. My job should come to finish state. 

    Q) Is it a know isssue are i am doing any thing wrong here.

    Scheduler sc = HPCJob.GetScheduler();

    string jobid =Guid.NewGuid().ToString();

    var job = HPCJob.GetJob(sc, jobid);

    String command=@"copy \\TT\Share\Test1\*.* \\TT\Share\Test2\*.*";

    job.RunUntilCanceled = true;

    HPCJob.AddTask(job, command);

    sc.SubmitJob(job, APPSettings.USER_ID, APPSettings.PASSWORD);

    System.Threading.Thread.Sleep(2000);

    var t= HPCJob.AddTask(job, command);

    job.SubmitTask(t);

    job.RunUntilCanceled = false;

    job.Commit();

    job.Refresh();

    Thanks in Advance
    PVASN Murthy

    Thursday, September 4, 2008 6:38 AM