diff --git a/roles/karaage3.1.17/templates/kg_init.j2 b/roles/karaage3.1.17/templates/kg_init.j2 index 110f3b7f667b1a9321d1b1f33e94520c6fc822cc..74bdf5bf0b1ba99f3e7b2c30e1eb7030bf280330 100755 --- a/roles/karaage3.1.17/templates/kg_init.j2 +++ b/roles/karaage3.1.17/templates/kg_init.j2 @@ -8,6 +8,8 @@ from karaage.institutes.models import Institute from karaage.machines.models import MachineCategory from karaage.people.models import Person, Group +CONSOLE_DEBUG = False + class HpcIdInit(): import django django.setup() @@ -17,6 +19,9 @@ class HpcIdInit(): self.path = configfile self.password = password self.debug = debug + if not debug: + self.logfile = open("/tmp/kg_init.log", "w") + if self.path and os.path.exists(self.path): with open(self.path) as data: config_data = json.load(data) @@ -26,9 +31,14 @@ class HpcIdInit(): else: log("Invalid input data") + def __del__(self): + self.logfile.close() + def log(self, message): if self.debug: print message + else: + self.logfile.write(message + "\n") def getGroup(self, name): group = None @@ -173,6 +183,7 @@ class HpcIdInit(): try: delegates = institute.delegates.all().filter(username = su.username) if len(delegates) == 0: + self.log("Create institution delegate %s"%(su.username)) institute.delegates.add(su) except: result = False @@ -216,7 +227,7 @@ def main(argv): if len(sys.argv) > 2: config_path = argv[0] password = argv[1] - debug = True + debug = CONSOLE_DEBUG if len(sys.argv) > 3: debug = argv[2] init = HpcIdInit(config_path, password, debug) diff --git a/roles/slurm-common/tasks/installSlurmFromSource.yml b/roles/slurm-common/tasks/installSlurmFromSource.yml index 3a3d2f2a3633cdea76a69fa62b16b0731cf104a7..ec9fbe5881b3188383da27589821cde48da977fa 100644 --- a/roles/slurm-common/tasks/installSlurmFromSource.yml +++ b/roles/slurm-common/tasks/installSlurmFromSource.yml @@ -36,4 +36,3 @@ - name: add slurm log rotate config template: src=slurmlog.j2 dest=/etc/logrotate.d/slurm mode=644 sudo: true - diff --git a/roles/slurm-common/templates/slurmlog.j2 b/roles/slurm-common/templates/slurmlog.j2 index 54731e01308d7ee15d470736242630112354e8e9..582740794e8e505db99f66a0db92b7ba6389bb12 100644 --- a/roles/slurm-common/templates/slurmlog.j2 +++ b/roles/slurm-common/templates/slurmlog.j2 @@ -1,4 +1,9 @@ -{{ slurmddebug.log }}/slurm*.log +{% if slurmctrl == inventory_hostname %} +{{ slurmctlddebug.log }} +{{ slurmschedlog.log }} +{% else %} +{{ slurmddebug.log }} +{% endif %} { compress missingok @@ -12,18 +17,12 @@ sharedscripts size=5M create 640 slurm root -{% if slurmctrl == inventory_hostname %} -{% if ansible_os_family == 'RedHat' and ansible_distribution_version >= '7' %} - systemctl restart slurmdbd -{% else %} - postrotate /etc/init.d/slurmdbd reconfig -{% endif %} -{% endif %} {% if ansible_os_family == 'RedHat' and ansible_distribution_version >= '7' %} + postrotate {% if slurmctrl == inventory_hostname %} - systemctl restart slurmctld + {{ slurm_dir }}/sbin/slurmctld flushlogs 1>/dev/null || true {% else %} - systemctl restart slurmd + {{ slurm_dir }}/sbin/slurmd flushlogs 1>/dev/null || true {% endif %} {% else %} postrotate /etc/init.d/slurm reconfig diff --git a/roles/slurmdb-config/tasks/main.yml b/roles/slurmdb-config/tasks/main.yml index aa3323f100099f3037206ab18e3f6afefbb35418..becf45105eff2e253c41da10feb35d8afa05f620 100644 --- a/roles/slurmdb-config/tasks/main.yml +++ b/roles/slurmdb-config/tasks/main.yml @@ -32,3 +32,7 @@ sudo: true when: slurm_dir is not defined +- name: add slurm db log rotate config + template: src=slurmdblog.j2 dest=/etc/logrotate.d/slurmdb mode=644 + sudo: true + diff --git a/roles/slurmdb-config/templates/slurmdblog.j2 b/roles/slurmdb-config/templates/slurmdblog.j2 new file mode 100644 index 0000000000000000000000000000000000000000..f9042d6b392781293a35c0c4d70f09f63813e809 --- /dev/null +++ b/roles/slurmdb-config/templates/slurmdblog.j2 @@ -0,0 +1,24 @@ +{{ slurmdbdlog.log }} +{% endif %} +{ + compress + missingok + nocopytruncate + nocreate + nodelaycompress + nomail + notifempty + noolddir + rotate 5 + sharedscripts + size=5M + create 640 slurm root +{% if ansible_os_family == 'RedHat' and ansible_distribution_version >= '7' %} + postrotate + {{ slurm_dir }}/sbin/slurmdbd flushlogs 1>/dev/null || true +{% else %} + postrotate /etc/init.d/slurmdbd reconfig +{% endif %} + endscript +} +