<commit_before>---
  - name: Copy 'is_cluster_ready' file
    copy:
      dest: /bin/is_cluster_ready
      content: "{{is_cluster_ready_script}}"
      mode: 0755

  - name: Update the /etc/hosts file
    shell: |
      for i in `seq 1 {{max_number_of_nodes}}`; do
        item="{{vnode_prefix}}${i}";
        grep -q "\<${item}\>" /etc/hosts || echo "127.0.0.1 ${item}.localdomain ${item}" >> /etc/hosts;
      done

  - name: Create the slurm.conf file
    template: dest={{ SLURM_CONF }} src=slurm.conf.j2

  - name: Set blcr config in SLURM
    lineinfile: dest={{ SLURM_CONF }} regexp='#CheckpointType=' line='CheckpointType=checkpoint/blcr' state=present
    when: "'blcr' in TEMPLATES"

  - name: Set 'ControlMachine' property on SLURM config file
    lineinfile: dest={{ SLURM_CONF }} regexp='ControlMachine=' line='ControlMachine=slurmserver' state=present

  - name: Configure compute nodes section of slurm.conf
    lineinfile: dest={{ SLURM_CONF }} regexp='NodeName={{item.id|replace('_','x')}}\[' line='NodeName={{item.id|replace('_','x')}}[0-{{item.ec3_max_instances_max|int - 1}}] CPUs=1 State=UNKNOWN' state=present
    with_items: '{{ SYSTEMS | selectattr("ec3_max_instances_max", "defined") | list }}'

  - name: Configure slurm.conf
    lineinfile: dest={{ SLURM_CONF }} regexp='PartitionName={{item.id}} ' line='PartitionName={{item.id}} Nodes={{item.id|replace('_','x')}}[0-{{item.ec3_max_instances_max|int - 1}}] MaxTime=INFINITE State=UP' state=present
    with_items: '{{ SYSTEMS | selectattr("ec3_max_instances_max", "defined") | list }}'

  # start SLURM slurmctld daemon
  - name: Start SLURM slurmctld daemon in Deb systems
    shell: pgrep slurmctld || nohup /usr/local/sbin/slurmctld > /dev/null 2>&1 &
    when: ansible_os_family == "Debian"

  - name: Start SLURM slurmctld daemon in RedHat systems
    command: systemctl start slurm
    when: ansible_os_family == "RedHat"

  - name: Reconfigure SLURM
    shell: scontrol reconfig<commit_msg>Fix node configuration in slurm config file<commit_after>---
  - name: Copy 'is_cluster_ready' file
    copy:
      dest: /bin/is_cluster_ready
      content: "{{is_cluster_ready_script}}"
      mode: 0755

  - name: Update the /etc/hosts file
    shell: |
      for i in `seq 1 {{max_number_of_nodes}}`; do
        item="{{vnode_prefix}}${i}";
        grep -q "\<${item}\>" /etc/hosts || echo "127.0.0.1 ${item}.localdomain ${item}" >> /etc/hosts;
      done

  - name: Create the slurm.conf file
    template: dest={{ SLURM_CONF }} src=slurm.conf.j2

  - name: Set blcr config in SLURM
    lineinfile: dest={{ SLURM_CONF }} regexp='#CheckpointType=' line='CheckpointType=checkpoint/blcr' state=present
    when: "'blcr' in TEMPLATES"

  - name: Set 'ControlMachine' property on SLURM config file
    lineinfile: dest={{ SLURM_CONF }} regexp='ControlMachine=' line='ControlMachine=slurmserver' state=present

  - name: Set node names in slurm.conf
    lineinfile: dest={{SLURM_CONF}} regexp='NodeName=' line='NodeName={{vnode_prefix}}[1-{{ec3_max_instances|int}}] CPUs=1 State=UNKNOWN'

  - name: Set partition name parameter in SLURM config file
    lineinfile: dest={{SLURM_CONF}} regexp='PartitionName=' line='PartitionName=debug Nodes={{vnode_prefix}}[1-{{ec3_max_instances|int}}] Default=YES MaxTime=INFINITE State=UP'

  # start SLURM slurmctld daemon
  - name: Start SLURM slurmctld daemon in Deb systems
    shell: pgrep slurmctld || nohup /usr/local/sbin/slurmctld > /dev/null 2>&1 &
    when: ansible_os_family == "Debian"

  - name: Start SLURM slurmctld daemon in RedHat systems
    command: systemctl start slurm
    when: ansible_os_family == "RedHat"

  - name: Reconfigure SLURM
    shell: scontrol reconfig
{'fraction_non_alphanumeric': 0.1445945945945946, 'fraction_numerical': 0.011351351351351352, 'mean_word_length': 4.104827586206897, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2080829', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1322, 'n_words': 309}