1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
36
#include "dispatcher.h"
37
#include "execd_ticket.h"
39
#include "msg_execd.h"
40
#include "sge_feature.h"
41
#include "sgeobj/sge_job.h"
42
#include "sgeobj/sge_pe.h"
43
#include "sgeobj/sge_ja_task.h"
49
/*************************************************************************
50
EXECD function called by dispatcher
52
get a list of jobid/tickets tuples and pass them to the PTF
53
*************************************************************************/
55
int do_ticket(sge_gdi_ctx_class_t *ctx, struct_msg_t *aMsg)
57
u_long32 jobid, jataskid;
59
lListElem *job_ticket, *task_ticket;
60
lList *ticket_modifier = NULL;
62
DENTER(TOP_LAYER, "do_ticket");
64
while (pb_unused(&(aMsg->buf))>0) {
65
lList *jatasks = NULL;
67
if (unpackint(&(aMsg->buf), &jobid) || unpackint(&(aMsg->buf), &jataskid)
68
|| unpackdouble(&(aMsg->buf), &ticket)) {
69
ERROR((SGE_EVENT, MSG_JOB_TICKETFORMAT));
72
DPRINTF(("got %lf new tickets for job "sge_u32"."sge_u32"\n", ticket, jobid, jataskid));
73
job_ticket = lAddElemUlong(&ticket_modifier, JB_job_number, jobid, JB_Type);
75
task_ticket = lAddElemUlong(&jatasks, JAT_task_number, jataskid, JAT_Type);
77
lSetDouble(task_ticket, JAT_tix, ticket);
79
lSetList(job_ticket, JB_ja_tasks, jatasks);
83
DPRINTF(("got new tickets for %d jobs\n", lGetNumberOfElem(ticket_modifier)));
88
/* forward new tickets to ptf */
89
if ((ptf_error=ptf_process_job_ticket_list(ticket_modifier))) {
90
ERROR((SGE_EVENT, MSG_JOB_TICKETPASS2PTF_IS,
91
lGetNumberOfElem(ticket_modifier),
92
ptf_errstr(ptf_error)));
95
sge_switch2start_user();
96
DPRINTF(("ADJUST PRIORITIES\n"));
97
ptf_adjust_job_priorities();
98
sge_switch2admin_user();
102
lFreeList(&ticket_modifier);