<commit_before># from __future__ import absolute_import

from cloudmesh_task.celery import app
from sh import ssh 
from pprint import pprint
import datetime

@app.task
def cm_ssh(host, username=None, command=None):

    result = dict({
        "host": host,
        "command": command,
        "username": username, 
        "output": "None",
        "error": "None",
        "time": "None"
        })

    now = datetime.datetime.now()
    try:
        
        result["time"] = str(now)
        result["output"] = str(ssh("{0}@{1}".format(username, host), "date; " + command))
        # result["output"] = "DEBUG {0} {1}".format(host, str(now))

    except Exception, e:

        result["error"] = str(e)

    return result

    <commit_msg>adding a start and end time<commit_after># from __future__ import absolute_import

from cloudmesh_task.celery import app
from sh import ssh 
from pprint import pprint
import datetime

@app.task
def cm_ssh(host, username=None, command=None):

    result = dict({
        "host": host,
        "command": command,
        "username": username, 
        "output": "None",
        "error": "None",
        "time_start": "None",
        "time_end": "None"
        })

    
    try:

        result["time_start"] = str(datetime.datetime.now())
        result["output"] = str(ssh("{0}@{1}".format(username, host), "date; " + command))
        # result["output"] = "DEBUG {0} {1}".format(host, str(now))
        result["time_end"] = str(datetime.datetime.now())
        
    except Exception, e:

        result["error"] = str(e)

    return result

    
{'fraction_non_alphanumeric': 0.15229704216488357, 'fraction_numerical': 0.005034612964128383, 'mean_word_length': 2.6054421768707483, 'pattern_counts': {'":': 13, '<': 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': '1072374', 'n_tokens_mistral': 509, 'n_tokens_neox': 488, 'n_words': 127}