utk-se / CodeAnalytics-analyzer

Single-shot code analysis for a code repo
1 stars 0 forks source link

Error during analysis #27

Closed robobenklein closed 4 years ago

robobenklein commented 4 years ago
[2020-02-20 04:07:36] [    INFO] [worker checkin] Checkin completed: claimed job
[2020-02-20 04:07:36] [    INFO] [worker main_loop] Claimed job: 5e28c91a1342c9331683f77a, going to work.
[2020-02-20 04:07:36] [    INFO] [worker checkin] Checkin completed: setup
[2020-02-20 04:07:36] [    INFO] [worker checkin] Checkin completed: clone
[2020-02-20 04:07:36] [    INFO] [worker run_job] Beginning clone for job 5e28c91a1342c9331683f77a
[2020-02-20 04:07:37] [    INFO] [worker checkin] Checkin completed: analyze
[2020-02-20 04:07:37] [   ERROR] [worker run_job] Unknown exception when calling the analysis_function!
[2020-02-20 04:07:37] [   ERROR] [worker __main__] Unknown exception: division by zero
[2020-02-20 04:07:37] [    INFO] [worker checkin] Checkin completed: error
Traceback (most recent call last):
  File "/home/ca-worker/venv/bin/ca-worker", line 8, in <module>
    sys.exit(__main__())
  File "/home/ca-worker/venv/lib/python3.6/site-packages/cadistributor/worker.py", line 251, in __main__
    raise e
  File "/home/ca-worker/venv/lib/python3.6/site-packages/cadistributor/worker.py", line 237, in __main__
    main_loop()
  File "/home/ca-worker/venv/lib/python3.6/site-packages/cadistributor/worker.py", line 265, in main_loop
    run_job(job)
  File "/home/ca-worker/venv/lib/python3.6/site-packages/cadistributor/worker.py", line 145, in run_job
    raise e # will let the main loop report error to server
  File "/home/ca-worker/venv/lib/python3.6/site-packages/cadistributor/worker.py", line 137, in run_job
    result = config['analysis']['function'](repodir)
  File "/home/ca-worker/venv/lib/python3.6/site-packages/caanalyzer/__main__.py", line 8, in analyze
    output = the_thing.analyze(input_path=path)
  File "/home/ca-worker/venv/lib/python3.6/site-packages/caanalyzer/analyzer.py", line 226, in analyze
    repo_obj["avg_file_length"] = repo_obj["num_lines"] / repo_obj["num_files"]
ZeroDivisionError: division by zero

Worker state:

{
    "endpoint" : "https://ca-core.unhexium.dev",
    "error" : {
        "type" : "<class 'ZeroDivisionError'>",
        "str" : "division by zero",
        "time" : ISODate("2020-02-20T04:07:37.023Z")
    },
    "job" : {
        "_id" : ObjectId("5e28c91a1342c9331683f77a"),
        "function" : "caanalyzer.__main__:analyze",
        "repodir" : "job-5e28c91a1342c9331683f77a",
        "url" : "https://github.com/shadowsocks/shadowsocks.git",
        "workdir" : "/tmp/ca-workdir/ca-worker-coretester1"
    },
    "lastcheckin" : ISODate("2020-02-20T04:07:37.023Z"),
    "lastcheckin_human" : "2020-02-20 04:07:37 ",
    "status" : "error"
}

aka. project has no files :/

argvrutter commented 4 years ago

Resolved