/*****************************************************************************\ * job_functions.c - functions dealing with jobs in the accounting system. ***************************************************************************** * Copyright (C) 2008-2010 Lawrence Livermore National Security. * Copyright (C) 2002-2008 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Danny Auble * CODE-OCEC-09-009. All rights reserved. * * This file is part of Slurm, a resource management program. * For details, see . * Please also read the included file: DISCLAIMER. * * Slurm is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * In addition, as a special exception, the copyright holders give permission * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than * OpenSSL. If you modify file(s) with this exception, you may extend this * exception to your version of the file(s), but you are not obligated to do * so. If you do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source files in * the program, then also delete it here. * * Slurm is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with Slurm; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \*****************************************************************************/ #include "src/sacctmgr/sacctmgr.h" static int _set_cond(int *start, int argc, char **argv, slurmdb_job_cond_t *job_cond) { int i; int set = 0; int end = 0; int command_len = 0; if (!job_cond) { error("No job_cond given"); return -1; } for (i=(*start); icluster_list) { job_cond->cluster_list = list_create(xfree_ptr); list_push(job_cond->cluster_list, slurm_get_cluster_name()); } (*start) = i; return set; } static int _set_rec(int *start, int argc, char **argv, slurmdb_job_rec_t *job) { int i; int set = 0; int end = 0; int command_len = 0; for (i=(*start); iderived_ec, "DerivedExitCode") == SLURM_SUCCESS) { set = 1; } } else if ((!xstrncasecmp(argv[i], "Comment", MAX(command_len, 7))) || (!xstrncasecmp(argv[i], "DerivedExitString", MAX(command_len, 12))) || (!xstrncasecmp(argv[i], "DerivedES", MAX(command_len, 9)))) { if (job->derived_es) xfree(job->derived_es); job->derived_es = strip_quotes(argv[i]+end, NULL, 1); set = 1; } else if (!xstrncasecmp(argv[i], "NewWCKey", MAX(command_len, 1))) { if (job->wckey) xfree(job->wckey); job->wckey = strip_quotes(argv[i]+end, NULL, 1); set = 1; } else { printf(" Unknown option: %s\n" " Use keyword 'where' to modify condition\n", argv[i]); } } (*start) = i; return set; } extern int sacctmgr_modify_job(int argc, char **argv) { int rc = SLURM_SUCCESS; slurmdb_job_cond_t *job_cond = xmalloc(sizeof(slurmdb_job_cond_t)); slurmdb_job_rec_t *job = slurmdb_create_job_rec(); int i=0; int cond_set = 0, rec_set = 0, set = 0; List ret_list = NULL; job_cond->db_flags = SLURMDB_JOB_FLAG_NOTSET; job_cond->flags = JOBCOND_FLAG_NO_DEFAULT_USAGE; for (i=0; i