class_docstr: Create a monitoring service that alerts on Task failures / completion in a Slack channel
class_docstr_tok: ["Create","a","monitoring","service","that","alerts","on","Task","failures","\/","completion","in","a","Slack","channel"]
docstr: Post message on our slack channel
  
  :param message: Message to be sent (markdown style)
  :param retries: Number of retries before giving up
  :param wait_period: wait between retries in seconds
docstr_tok: ["Post","message","on","our","slack","channel",":","param","message",":","Message","to","be","sent","(","markdown","style",")",":","param","retries",":","Number","of","retries","before","giving","up",":","param","wait_period",":","wait","between","retries","in","seconds"]
code: def post_message(self, message, retries=1, wait_period=10.0):
      # type: (str, int, float) -> ()
      """
      Post message on our slack channel
  
      :param message: Message to be sent (markdown style)
      :param retries: Number of retries before giving up
      :param wait_period: wait between retries in seconds
      """
      for i in range(retries):
          if i != 0:
              sleep(wait_period)
  
          try:
              self.slack_client.chat_postMessage(
                  channel=self._channel_id,
                  blocks=[
                      dict(
                          type="section",
                          text={"type": "mrkdwn", "text": message},
                      )
                  ],
              )
              return
          except SlackApiError as e:
              print(
                  'While trying to send message: "\n{}\n"\nGot an error: {}'.format(
                      message, e.response["error"]
                  )
              )
  
file_path: clearml/examples/services/monitoring/slack_alerts.py
imports: import argparse
  import os
  from pathlib import Path
  from time import sleep
  from typing import Optional, Callable, List, Union
  from slack_sdk import WebClient
  from slack_sdk.errors import SlackApiError
  from clearml import Task
  from clearml.automation.monitor import Monitor
label_desc: Use image node_id 3 for calling the SlackMonitor obj's underlying member method code with example usage: obj.post_message(message, retries, wait_period) without return types