~ubuntu-branches/ubuntu/raring/slurm-llnl/raring

« back to all changes in this revision

Viewing changes to src/slurmctld/acct_policy.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2010-09-03 18:03:29 UTC
  • mfrom: (3.3.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100903180329-t0t8mtvk2eoctoso
Tags: 2.1.14-1
New upstream release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
367
367
        bool rc = true;
368
368
        uint64_t usage_mins;
369
369
        uint32_t wall_mins;
 
370
        bool cancel_job = 0;
370
371
        int parent = 0; /*flag to tell us if we are looking at the
371
372
                         * parent or not
372
373
                         */
391
392
                job_ptr->state_reason = WAIT_NO_REASON;
392
393
 
393
394
        slurm_mutex_lock(&assoc_mgr_qos_lock);
 
395
        /* Since we could possibly need the association lock handle it
 
396
           now to avoid deadlock. Always do QOS first.
 
397
        */
 
398
        slurm_mutex_lock(&assoc_mgr_association_lock);
394
399
        qos_ptr = job_ptr->qos_ptr;
395
400
        if(qos_ptr) {
396
401
                usage_mins = (uint64_t)(qos_ptr->usage_raw / 60.0);
407
412
                               qos_ptr->name, qos_ptr->grp_cpu_mins,
408
413
                               usage_mins);
409
414
                        rc = false;
410
 
                        goto end_qos;
 
415
                        goto end_it;
411
416
                }
412
417
 
413
418
                /* NOTE: We can't enforce qos_ptr->grp_cpus at this
426
431
                               qos_ptr->grp_used_jobs, qos_ptr->name);
427
432
 
428
433
                        rc = false;
429
 
                        goto end_qos;
 
434
                        goto end_it;
430
435
                }
431
436
 
432
437
                if (qos_ptr->grp_nodes != INFINITE) {
438
443
                                     job_ptr->details->min_nodes,
439
444
                                     qos_ptr->grp_nodes,
440
445
                                     qos_ptr->name);
441
 
                                _cancel_job(job_ptr);
 
446
                                cancel_job = 1;
442
447
                        } else if ((qos_ptr->grp_used_nodes +
443
448
                                    job_ptr->details->min_nodes) >
444
449
                                   qos_ptr->grp_nodes) {
456
461
                                       job_ptr->details->min_nodes,
457
462
                                       qos_ptr->name);
458
463
                                rc = false;
459
 
                                goto end_qos;
 
464
                                goto end_it;
460
465
                        }
461
466
                }
462
467
 
475
480
                               wall_mins, qos_ptr->name);
476
481
 
477
482
                        rc = false;
478
 
                        goto end_qos;
 
483
                        goto end_it;
479
484
                }
480
485
 
481
486
                /* NOTE: We can't enforce qos_ptr->max_cpu_mins_pj at this
506
511
                                       qos_ptr->max_jobs_pu,
507
512
                                       used_limits->jobs, qos_ptr->name);
508
513
                                rc = false;
509
 
                                goto end_qos;
 
514
                                goto end_it;
510
515
                        }
511
516
                }
512
517
 
519
524
                                     job_ptr->job_id,
520
525
                                     job_ptr->details->min_nodes,
521
526
                                     qos_ptr->max_nodes_pj);
522
 
                                _cancel_job(job_ptr);
 
527
                                cancel_job = 1;
523
528
                                rc = false;
524
 
                                goto end_qos;
 
529
                                goto end_it;
525
530
                        }
526
531
                }
527
532
 
537
542
                                     "time limit %u exceeds account max %u",
538
543
                                     job_ptr->job_id, job_ptr->time_limit,
539
544
                                     time_limit);
540
 
                                _cancel_job(job_ptr);
 
545
                                cancel_job = 1;
541
546
                                rc = false;
542
 
                                goto end_qos;
 
547
                                goto end_it;
543
548
                        }
544
549
                }
545
550
        }
546
551
 
547
 
        slurm_mutex_lock(&assoc_mgr_association_lock);
548
552
        assoc_ptr = job_ptr->assoc_ptr;
549
553
        while(assoc_ptr) {
550
554
                usage_mins = (uint64_t)(assoc_ptr->usage_raw / 60.0);
599
603
                                     job_ptr->job_id,
600
604
                                     job_ptr->details->min_nodes,
601
605
                                     assoc_ptr->grp_nodes, assoc_ptr->acct);
602
 
                                _cancel_job(job_ptr);
 
606
                                cancel_job = 1;
603
607
                        } else if ((assoc_ptr->grp_used_nodes +
604
608
                                    job_ptr->details->min_nodes) >
605
609
                                   assoc_ptr->grp_nodes) {
686
690
                                     job_ptr->job_id,
687
691
                                     job_ptr->details->min_nodes,
688
692
                                     assoc_ptr->max_nodes_pj);
689
 
                                _cancel_job(job_ptr);
 
693
                                cancel_job = 1;
690
694
                                rc = false;
691
695
                                goto end_it;
692
696
                        }
706
710
                                     "time limit %u exceeds account max %u",
707
711
                                     job_ptr->job_id, job_ptr->time_limit,
708
712
                                     time_limit);
709
 
                                _cancel_job(job_ptr);
 
713
                                cancel_job = 1;
710
714
                                rc = false;
711
715
                                goto end_it;
712
716
                        }
717
721
        }
718
722
end_it:
719
723
        slurm_mutex_unlock(&assoc_mgr_association_lock);
720
 
end_qos:
721
724
        slurm_mutex_unlock(&assoc_mgr_qos_lock);
 
725
 
 
726
        if(cancel_job)
 
727
                _cancel_job(job_ptr);
 
728
 
722
729
        return rc;
723
730
}