[torqueusers] [PATCH 1/3] pbs_server: add cgroup_enable to server attribute

levin li levin108 at gmail.com
Tue Nov 20 02:02:02 MST 2012


Signed-off-by: levin li <levin108 at gmail.com>
---
 src/include/pbs_ifl.h         |    2 ++
 src/include/pbs_job.h         |    1 +
 src/include/qmgr_svr_public.h |    1 +
 src/include/server.h          |    1 +
 src/server/job_attr_def.c     |   13 +++++++++++++
 src/server/req_quejob.c       |    7 +++++++
 src/server/svr_attr_def.c     |   13 +++++++++++++
 7 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/include/pbs_ifl.h b/src/include/pbs_ifl.h
index 9065192..47e589a 100644
--- a/src/include/pbs_ifl.h
+++ b/src/include/pbs_ifl.h
@@ -117,6 +117,7 @@
 #define ATTR_login_prop "login_property"
 #define ATTR_external_nodes "external_nodes"
 #define ATTR_multi_req_alps "multi_req_alps"
+#define ATTR_cgroup_enable "cgropu_enable"
 #define ATTR_M "Mail_Users"
 #define ATTR_N "Job_Name"
 #define ATTR_S "Shell_Path_List"
@@ -221,6 +222,7 @@
 #define ATTR_maxgrprun   "max_group_run"
 #define ATTR_maxque      "max_queuable"
 #define ATTR_maxuserque  "max_user_queuable"
+#define ATTR_cgroupenable "cgroup_enable"
 #define ATTR_maxuserrun  "max_user_run"
 #define ATTR_qtype       "queue_type"
 #define ATTR_rescassn    "resources_assigned"
diff --git a/src/include/pbs_job.h b/src/include/pbs_job.h
index 35f75f0..6e5624c 100644
--- a/src/include/pbs_job.h
+++ b/src/include/pbs_job.h
@@ -379,6 +379,7 @@ enum job_atr
   JOB_ATR_login_prop,
   JOB_ATR_external_nodes,
   JOB_ATR_multi_req_alps,
+  JOB_ATR_cgroup_enable,
 #include "site_job_attr_enum.h"
 
   JOB_ATR_UNKN,  /* the special "unknown" type    */
diff --git a/src/include/qmgr_svr_public.h b/src/include/qmgr_svr_public.h
index 4233ca2..bcfb1b6 100644
--- a/src/include/qmgr_svr_public.h
+++ b/src/include/qmgr_svr_public.h
@@ -179,3 +179,4 @@ ATTR_nomailforce,
 ATTR_crayenabled,
 ATTR_interactivejobscanroam,
 ATTR_maxuserqueuable,
+ATTR_cgroupenable,
diff --git a/src/include/server.h b/src/include/server.h
index 2b6f4a2..289ad51 100644
--- a/src/include/server.h
+++ b/src/include/server.h
@@ -201,6 +201,7 @@ enum srv_atr
   SRV_ATR_CrayEnabled,
   SRV_ATR_InteractiveJobsCanRoam,
   SRV_ATR_MaxUserQueuable,
+  SRV_ATR_cgroup_enable,
 
 #include "site_svr_attr_enum.h"
   /* This must be last */
diff --git a/src/server/job_attr_def.c b/src/server/job_attr_def.c
index 689baed..abab606 100644
--- a/src/server/job_attr_def.c
+++ b/src/server/job_attr_def.c
@@ -1183,6 +1183,19 @@ attribute_def job_attr_def[] =
    ATR_TYPE_STR,
    PARENT_TYPE_JOB},
 
+  /* JOB_ATR_cgroup_enable */
+  { ATTR_cgroup_enable,  /* "cgroup_enable" */
+    decode_l,
+    encode_inter,
+    set_l,
+    comp_b,
+    free_null,
+    NULL_FUNC,
+    READ_ONLY | ATR_DFLAG_SvRD | ATR_DFLAG_Creat | ATR_DFLAG_SELEQ | ATR_DFLAG_MOM,
+    ATR_TYPE_LONG,
+    PARENT_TYPE_JOB
+  },
+
   /* Site defined attributes if any, see site_job_attr_*.h  */
 #include "site_job_attr_def.h"
 
diff --git a/src/server/req_quejob.c b/src/server/req_quejob.c
index 6acebac..35e4cf7 100644
--- a/src/server/req_quejob.c
+++ b/src/server/req_quejob.c
@@ -487,6 +487,7 @@ int req_quejob(
   int                   resc_access_perm = ATR_DFLAG_USWR | ATR_DFLAG_Creat;
   int                   i;
   int                   fds;
+  long                  cgroup_enable = FALSE;
 
   char                 *jid;
   char                 *pc;
@@ -746,6 +747,12 @@ int req_quejob(
   pj->ji_qs.ji_un_type  = JOB_UNION_TYPE_NEW;
   pj->ji_wattr[JOB_ATR_mailpnts].at_val.at_str = 0;
 
+  /* tell job whether to cgroup */
+  get_svr_attr_l(SRV_ATR_cgroup_enable, &cgroup_enable);
+  if (cgroup_enable) {
+    pj->ji_wattr[JOB_ATR_cgroup_enable].at_flags |= ATR_VFLAG_SET;
+  }
+
   /* decode attributes from request into job structure */
 
   psatl = (svrattrl *)GET_NEXT(preq->rq_ind.rq_queuejob.rq_attr);
diff --git a/src/server/svr_attr_def.c b/src/server/svr_attr_def.c
index 19beeb9..0276fe5 100644
--- a/src/server/svr_attr_def.c
+++ b/src/server/svr_attr_def.c
@@ -1331,6 +1331,19 @@ attribute_def svr_attr_def[] =
    ATR_TYPE_LONG,
    PARENT_TYPE_SERVER},
 
+  /* SRV_ATR_acl_host_enable */
+  { ATTR_cgroupenable,  /* "acl_host_enable" */
+    decode_b,
+    encode_b,
+    set_b,
+    comp_b,
+    free_null,
+    NULL_FUNC,
+    MGR_ONLY_SET,
+    ATR_TYPE_LONG,
+    PARENT_TYPE_SERVER
+  },
+
   /* site supplied server pbs_attribute definitions if any, see site_svr_attr_*.h  */
 #include "site_svr_attr_def.h"
 
-- 
1.7.6.1



More information about the torqueusers mailing list