def get_runtime(job):
    """Returns the runtime in milliseconds or None if job is still running"""
    if job.metadata.get("finished_time") is not None:
        finished_time = job.metadata.get("finished_time")
    else:
        return None
    start_time = job.metadata.get("scrapystats")["start_time"]
    return float(finished_time - start_time)