Пример #1
0
    help="Weather to use multiple cores for testing. Optionally the "
    "targets for which mpi should be used, can be passed as "
    "arguments. If none are passed, all are run in parallel.")

parser.add_argument('--notify-slack',
                    action='store_true',
                    help="Send progress reports through Slack via ClusterBot "
                    "(if installed)")

args = utils.parse_arguments(parser)

bot = None
if args.notify_slack:
    try:
        from clusterbot import ClusterBot
        bot = ClusterBot()
    except ImportError:
        print("WARNING: clusterbot not installed. Can't notify slack.")
        pass

buffer = utils.PrintBuffer(clusterbot=bot)

import os, sys
from StringIO import StringIO

from brian2 import test, prefs
import brian2cuda

all_prefs_combinations, print_lines = utils.set_preferences(args,
                                                            prefs,
                                                            return_lines=True)
Пример #2
0
                assert append_message is not None
                bot.append(append_message, string)
        except Exception as exc:
            print(f"ERROR: Failed to send message to slack ({exc})", flush=True)
    return to_return

bot = None
if not args.no_slack:
    try:
        from clusterbot import ClusterBot
    except ImportError:
        print("WARNING: clusterbot not installed. Can't notify slack.")
    else:
        print_flushed("Starting ClusterBot...", slack=False)
        try:
            bot = ClusterBot()
        except Exception as exc:
            print(
                f"ERROR: ClusterBot failed to initialize correctly. Can't notify "
                f"slack. Here is the error:\n{exc}"
            )
            bot = None


#suppress_brian2_logs()
# Uncomment this to get brian2cuda logs
# (Set log_level_diagnostic() for DynamicConfigCreator diagnostic messages)
BrianLogger.log_level_debug()


# The configuration classes are defined in
Пример #3
0
import time
from clusterbot import ClusterBot, activate_logger

# Print confirmation about sent Slack messages
activate_logger()
# Debug mode
#activate_logger('DEBUG')

# Send a message to the default user specified in you config files.
bot = ClusterBot()
message_id = bot.send("Starting example script.")
# Reply to the default user message from above (open a ne Thread).
bot.reply(message_id, "Waiting for 5s.")
# Wait 5 seconds.
time.sleep(5)
# Reply again.
bot.reply(message_id, "5s have passed.")

# Send a message to someone else (not default user)
message_id = bot.send("Hi Denis. I started using ClusterBot :tada:",
                     user_name="Denis Alevi")
# Reply to that message (message_id has to belong to a message exchanged with
# ``user_name``)
bot.reply(message_id, "And I ran the example script!", user_name="Denis Alevi")