Last active
December 25, 2015 21:49
-
-
Save pmbuko/7044914 to your computer and use it in GitHub Desktop.
Add SGE userset to queues. (http://yourmacguy.wordpress.com/2009/06/01/quickly-add-a-userset-to-many-sun-grid-engine-queues/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
# This script automates the process of adding usersets to the user_lists section | |
# of the SGE cluster queue configs. It takes the userset name as a command line | |
# argument or it prompts for the userset name if no argument is given. Multiple | |
# lists can be submitted as a comma-separated list *without spaces*. | |
# queues to be modified | |
my @queues = qw( | |
archive.q | |
gpu.q | |
interactive.q | |
new.q | |
old.q | |
short.q | |
); | |
my $input=$ARGV[0]; | |
# If no arguments passed, print helpful info and prompt for userset name | |
if (! defined($input)) { | |
print join( "\n ", "\nThis command will add a new userset to the following cluster queues:\n" , @queues , "\n" ); | |
# Get input from STDIN. | |
print "Enter the name of the new userset (or ^c to exit). Use commas *without spaces* to separate multiple lists): "; | |
chomp($input=<STDIN>); | |
} | |
# Add the supplied usersets to each queue using 'qconf -aattr' method | |
foreach my $queue (@queues) { | |
system("qconf -aattr queue user_lists $input $queue"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment