<commit_before>import os
from rackattack.ssh import connection
from rackattack import clientfactory
from rackattack import api
connection.discardParamikoLogs()
connection.discardSSHDebugMessages()
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("--label", required=True)
parser.add_argument("--user", required=True, help="User to report to provider")
parser.add_argument("--nice", type=float, default=1)
args = parser.parse_args()

print "Connecting"
client = clientfactory.factory()
print "Allocating"
allocation = client.allocate(
    requirements={'node': api.Requirement(imageLabel=args.label, imageHint="playaround")},
    allocationInfo=api.AllocationInfo(user=args.user, purpose="playaround", nice=args.nice))
allocation.wait(timeout=8 * 60)
assert allocation.done(), "Allocation failed"
print "Done allocating, Waiting for boot to finish"
try:
    node = allocation.nodes()['node']
    credentials = node.rootSSHCredentials()
    ssh = connection.Connection(**credentials)
    ssh.waitForTCPServer()
    ssh.connect()
    ssh.close()
    print "ROOT SSH Credentials:"
    print credentials
    print "Opening ssh session. Close it to free up allocation"
    os.system(
        "sshpass -p %(password)s ssh -o ServerAliveInterval=5 -o ServerAliveCountMax=1 "
        "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p %(port)d "
        "%(username)s@%(hostname)s" % credentials)
finally:
    allocation.free()<commit_msg>Playaround tool now supports avoiding an ssh connection<commit_after>import os
from rackattack.ssh import connection
from rackattack import clientfactory
from rackattack import api
connection.discardParamikoLogs()
connection.discardSSHDebugMessages()
import argparse
import time

parser = argparse.ArgumentParser()
parser.add_argument("--label", required=True)
parser.add_argument("--user", required=True, help="User to report to provider")
parser.add_argument("--nice", type=float, default=1)
parser.add_argument("--noSSH", action='store_true', default=False)
args = parser.parse_args()

print "Connecting"
client = clientfactory.factory()
print "Allocating"
allocation = client.allocate(
    requirements={'node': api.Requirement(imageLabel=args.label, imageHint="playaround")},
    allocationInfo=api.AllocationInfo(user=args.user, purpose="playaround", nice=args.nice))
allocation.wait(timeout=8 * 60)
assert allocation.done(), "Allocation failed"
print "Done allocating, Waiting for boot to finish"
try:
    node = allocation.nodes()['node']
    credentials = node.rootSSHCredentials()
    print "ROOT SSH Credentials:"
    print credentials
    if not args.noSSH:
        ssh = connection.Connection(**credentials)
        ssh.waitForTCPServer()
        ssh.connect()
        ssh.close()
        print "Opening ssh session. Close it to free up allocation"
        os.system(
            "sshpass -p %(password)s ssh -o ServerAliveInterval=5 -o ServerAliveCountMax=1 "
            "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p %(port)d "
            "%(username)s@%(hostname)s" % credentials)
    else:
        print "Not connecting to machine via SSH. Hit Ctrl-C to close the machine."
        time.sleep(1000000000)
finally:
    allocation.free()
{'fraction_non_alphanumeric': 0.11801050355267223, 'fraction_numerical': 0.006796416434970652, 'mean_word_length': 4.690685413005272, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '6616806', 'n_tokens_mistral': 982, 'n_tokens_neox': 949, 'n_words': 243}