~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/sacctmgr/common.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *  Copyright (C) 2002-2007 The Regents of the University of California.
6
6
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
7
7
 *  Written by Danny Auble <da@llnl.gov>
8
 
 *  LLNL-CODE-402394.
 
8
 *  CODE-OCEC-09-009. All rights reserved.
9
9
 *  
10
10
 *  This file is part of SLURM, a resource management program.
11
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
11
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
12
 *  Please also read the included file: DISCLAIMER.
12
13
 *  
13
14
 *  SLURM is free software; you can redistribute it and/or modify it under
14
15
 *  the terms of the GNU General Public License as published by the Free
653
654
        return SLURM_SUCCESS;
654
655
}
655
656
 
 
657
extern int get_double(char *in_value, double *out_value, char *type)
 
658
{
 
659
        char *ptr = NULL, *meat = NULL;
 
660
        double num;
 
661
        
 
662
        if(!(meat = strip_quotes(in_value, NULL, 1))) {
 
663
                error("Problem with strip_quotes");
 
664
                return SLURM_ERROR;
 
665
        }
 
666
        num = strtod(meat, &ptr);
 
667
        if ((num == 0) && ptr && ptr[0]) {
 
668
                error("Invalid value for %s (%s)", type, meat);
 
669
                xfree(meat);
 
670
                return SLURM_ERROR;
 
671
        }
 
672
        xfree(meat);
 
673
        
 
674
        if (num < 0)
 
675
                *out_value = (double) INFINITE;         /* flag to clear */
 
676
        else
 
677
                *out_value = (double) num;
 
678
        return SLURM_SUCCESS;
 
679
}
 
680
 
656
681
extern int addto_qos_char_list(List char_list, List qos_list, char *names, 
657
682
                               int option)
658
683
{
970
995
extern void sacctmgr_print_coord_list(
971
996
        print_field_t *field, List value, int last)
972
997
{
 
998
        int abs_len = abs(field->len);
973
999
        ListIterator itr = NULL;
974
1000
        char *print_this = NULL;
975
1001
        acct_coord_rec_t *object = NULL;
998
1024
        else if(print_fields_parsable_print)
999
1025
                printf("%s|", print_this);
1000
1026
        else {
1001
 
                if(strlen(print_this) > field->len) 
1002
 
                        print_this[field->len-1] = '+';
 
1027
                if(strlen(print_this) > abs_len)
 
1028
                        print_this[abs_len-1] = '+';
1003
1029
                
1004
 
                printf("%-*.*s ", field->len, field->len, print_this);
 
1030
                if(field->len == abs_len)
 
1031
                        printf("%*.*s ", abs_len, abs_len, print_this);
 
1032
                else
 
1033
                        printf("%-*.*s ", abs_len, abs_len, print_this);
1005
1034
        }
1006
1035
        xfree(print_this);
1007
1036
}
1009
1038
extern void sacctmgr_print_qos_list(print_field_t *field, List qos_list,
1010
1039
                                    List value, int last)
1011
1040
{
 
1041
        int abs_len = abs(field->len);
1012
1042
        char *print_this = NULL;
1013
1043
 
1014
1044
        print_this = get_qos_complete_str(qos_list, value);
1019
1049
        else if(print_fields_parsable_print)
1020
1050
                printf("%s|", print_this);
1021
1051
        else {
1022
 
                if(strlen(print_this) > field->len) 
1023
 
                        print_this[field->len-1] = '+';
 
1052
                if(strlen(print_this) > abs_len) 
 
1053
                        print_this[abs_len-1] = '+';
1024
1054
                
1025
 
                printf("%-*.*s ", field->len, field->len, print_this);
 
1055
                if(field->len == abs_len)
 
1056
                        printf("%*.*s ", abs_len, abs_len, print_this);
 
1057
                else
 
1058
                        printf("%-*.*s ", abs_len, abs_len, print_this);
1026
1059
        }
1027
1060
        xfree(print_this);
1028
1061
}
1032
1065
        if(!assoc)
1033
1066
                return;
1034
1067
 
1035
 
        if(assoc->fairshare == INFINITE)
 
1068
        if(assoc->shares_raw == INFINITE)
1036
1069
                printf("  Fairshare     = NONE\n");
1037
 
        else if(assoc->fairshare != NO_VAL) 
1038
 
                printf("  Fairshare     = %u\n", assoc->fairshare);
 
1070
        else if(assoc->shares_raw != NO_VAL) 
 
1071
                printf("  Fairshare     = %u\n", assoc->shares_raw);
1039
1072
 
1040
1073
        if(assoc->grp_cpu_mins == INFINITE)
1041
1074
                printf("  GrpCPUMins    = NONE\n");