DistributedTaskScheduling / JobAdder

Source code of the JobAdder project
GNU General Public License v3.0
2 stars 1 forks source link

Crash in the database #145

Closed ammen99 closed 4 years ago

ammen99 commented 4 years ago

I encountered this during testing #143:

Traceback (most recent call last):
  File "/usr/bin/ja-server", line 17, in <module>
    ServerCLI()
  File "/usr/lib/python3.7/site-packages/ja/common/cli_util.py", line 17, in __init__
    self.run_main()
  File "/usr/bin/ja-server", line 13, in run_main
    JobCenter().run()
  File "/usr/lib/python3.7/site-packages/ja/server/main.py", line 94, in run
    self._handler.main_loop()
  File "/usr/lib/python3.7/site-packages/ja/common/proxy/command_handler.py", line 88, in main_loop
    username=input_dict["username"]
  File "/usr/lib/python3.7/site-packages/ja/common/proxy/command_handler.py", line 51, in _check_exit_or_process_command
    return self._process_command_dict(command_dict, type_name, username)
  File "/usr/lib/python3.7/site-packages/ja/server/proxy/command_handler.py", line 89, in _process_command_dict
    response = self._process_worker_message(command_dict, type_name, username)
  File "/usr/lib/python3.7/site-packages/ja/server/proxy/command_handler.py", line 74, in _process_worker_message
    return self._execute_command(worker_command)
  File "/usr/lib/python3.7/site-packages/ja/server/proxy/command_handler.py", line 60, in _execute_command
    r_dict = command.execute(self._database)
  File "/usr/lib/python3.7/site-packages/ja/worker/message/register.py", line 37, in execute
    database.update_work_machine(self._work_machine)
  File "/usr/lib/python3.7/site-packages/ja/server/database/sql/database.py", line 260, in update_work_machine
    "old machine: \n %s \n new machine: \n %s" % (str(machine), str(work_machine)))
  File "/usr/lib/python3.7/site-packages/ja/common/message/base.py", line 105, in __str__
    as_yaml = yaml.dump(self.to_dict())
  File "/usr/lib/python3.7/site-packages/ja/server/database/types/work_machine.py", line 197, in to_dict
    n_dict["resources"] = self._resources.to_dict()
AttributeError: 'NoneType' object has no attribute 'to_dict'
nikolatzotchev commented 4 years ago

The issue was that this method 2020-03-27-023128_grim was setting the resources to None, when the workmachine was OFFLINE, I was using this in 2020-03-27-023552_grim 269 line and when the server was cleaning up after shutdown it was setting the WorkMachine to OFFLINE and thus the method was returning None.