none
ReadyForProcessing job never get Queue

    السؤال

  • Hi all,

    I´m gonna try to explain our problem. We are developing a small Event Handler for OnCreated Project. What we are trying to attain with this handler is that depending on certain CF values, write and insert another CF value (seems simple).

    At our code, we can consult all the Project Web Services and get ProjectDatasets, that is not the problem. The problem come in the below lines:

     project.QueueAddToProject(JobId, SessionId, psDSET,false);
     WaitForQueue(q, JobId);

    All seems nice, but the Job get stucked at queue, reproducing again & again the same message:

    Job State: ReadyForProcessing Job ID: 88e18be3-4bc3-4f26-a5c9-5f80e65aa33f -- Wait: 4
    
    I was waiting more than hour, an nothing...

    Do I miss something?? Questions & answers would be gratefully received.

    THANKSS!!


    Miguel Soler

    29/ربيع الثاني/1433 04:17 م

جميع الردود

  • Hi Miguel,

    Ok, seems that you are updating the value in PDS.Project CustomFields rows , now the PDS is updated. Did you try to use the QueueUpdateProject instead of QueueAddToProject?

    Sample to Read the project dataset.TAskCustomfields, delete the specific Task custom field & checkout, updateproject &  checckin project.

    // Sample project and task custom field GUIDs:
    Guid projectId = new Guid("B6064244-101A-4139-A2F8-697620458AAE");
    Guid taskCustomFieldId = new Guid("a3549fbc-b49c-42c9-9c56-ba045e438d94");
    Guid sessionId = Guid.NewGuid();
    Guid jobId = Guid.NewGuid();
    WebSvcProject.ProjectDataSet dsProject = 
        project.ReadProject(projectId, WebSvcProject.DataStoreEnum.WorkingStore);
    // Do not use QueueDeleteFromProject to delete a custom field.
    // Guid[] taskCustomFields = { taskCustomFieldId };
    // project.QueueDeleteFromProject(jobId, sessionId, projectId, taskCustomFields);
    bool deleteCF = false;
    foreach (WebSvcProject.ProjectDataSet.TaskCustomFieldsRow taskCFRow in dsProject.TaskCustomFields)
    {
        if ((Guid)taskCFRow[dsProject.TaskCustomFields.CUSTOM_FIELD_UIDColumn] == taskCustomFieldId)
        {
            // Set the rowstate to be deleted.
            taskCFRow.Delete();
            deleteCF = true;
            break;
        }
    }
    if (deleteCF)
    {
        project.CheckOutProject(projectId, sessionId, "Test checkout");
        bool validateOnly = false;
        project.QueueUpdateProject(jobId, sessionId, dsProject, validateOnly);
        // Wait 4 seconds (more or less) for queue to finish
        // Or, add a routine that checks the QueueSystem for job completion.
        System.Threading.Thread.Sleep(4000);
        sessionId = Guid.NewGuid();
        jobId = Guid.NewGuid();
        bool force = false;
        string sessionDescription = "Removed task custom field " + taskCustomFieldId.ToString();
        project.QueueCheckInProject(jobId, projectId, force, sessionId, sessionDescription);
        // Wait 4 seconds (more or less) for queue to finish
        // Or, use a routine that checks the QueueSystem for job completion.
        System.Threading.Thread.Sleep(4000);
    }
    Hope that helps.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82

    30/ربيع الثاني/1433 05:44 ص
  • Hi Amit,

    In this case I´m not making a CheckOut, because as I explained, is an Event Handler, concretly the OnCreated one. So I get the SessionID that is used at that moment:

    projectDataSet.Project[0].PROJ_SESSION_UID

    I´ve tried also with UpdateProject too, even it has no sense because the CF was never added, it´s the first time is used. Anyway, QueueUpdateProject has the same behaviour than QueueAddToProject...

    I´m doing something wrong but I don´t know exactly what.

    Thanks!


    Miguel Soler

    30/ربيع الثاني/1433 08:51 ص
  • Hi Miguelet_,

    Is it possible that your queue is "blocked" ? If you save or publish a plan from PWA, the job complete succesfully or stuck in the queue?

    Anyway, if you custom field is not already set in you ProjectDataSet after project is created, you should use QueueAddToProject in order to add custom field value.

    I hope this can helps you,

    Best Regards

    Paolo O.

    04/جمادى الأولى/1433 06:10 م