<commit_before>#!/bin/bash

# Log argument to the syslog.
drbd_log () {
  logger -t "addon-drbdmanage" "$1"
}

# Return newline separated list of nodes that are assigned to a resource.
drbd_get_res_nodes () {
  res_name=$1

  res_nodes="$(sudo drbdmanage assignments -m --resources $res_name | awk -F',' '{ print $1 }')"

  if [ -n "$res_nodes" ]; then
    echo "$res_nodes"
  else
    exit -1
  fi
}

# Return single node with a resource assigned to it.
drbd_get_assignment_node () {
  res_name=$1

  drbd_log "Getting assignment for $res_name"
  echo $(drbd_get_res_nodes $res_name | head -n 1 )
}

# Check if resource is in connected and deployed on a single node.
drbd_is_res_deployed () {
  res_name=$1
  node_name=$2
  client_option=$3
<commit_msg>add script name to logger<commit_after>#!/bin/bash

# Log argument to the syslog.
drbd_log () {
  logger -t "addon-drbdmanage" "${0##*/}: $1"
}

# Return newline separated list of nodes that are assigned to a resource.
drbd_get_res_nodes () {
  res_name=$1

  res_nodes="$(sudo drbdmanage assignments -m --resources $res_name | awk -F',' '{ print $1 }')"

  if [ -n "$res_nodes" ]; then
    echo "$res_nodes"
  else
    exit -1
  fi
}

# Return single node with a resource assigned to it.
drbd_get_assignment_node () {
  res_name=$1

  drbd_log "Getting assignment for $res_name"
  echo $(drbd_get_res_nodes $res_name | head -n 1 )
}

# Check if resource is in connected and deployed on a single node.
drbd_is_res_deployed () {
  res_name=$1
  node_name=$2
  client_option=$3

{'fraction_non_alphanumeric': 0.11895424836601307, 'fraction_numerical': 0.01241830065359477, 'mean_word_length': 3.710769230769231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '481234', 'n_tokens_mistral': 570, 'n_tokens_neox': 547, 'n_words': 171}