project-receptor / python-receptor

Project Receptor is a flexible multi-service relayer with remote execution and orchestration capabilities linking controllers with executors across a mesh of nodes.
Other
32 stars 21 forks source link

Transient commands should clean up after themselves #119

Closed matburt closed 4 years ago

matburt commented 4 years ago

Some of the cli commands are transient (ping, send, status, etc). These commands create and persist a directory and manifest record in the run directory for receptor when they don't need to. We could use tmp or just force cleanup the directories that receptor normally creates so that it doesn't pollute the system.

ghjm commented 4 years ago

This was fixed by https://github.com/project-receptor/receptor/pull/128

matburt commented 4 years ago

Closing since it's been 2 weeks.

Ichimonji10 commented 4 years ago

Re-opening because we don't actually know whether this issue is fixed.

Where is the run directory? I'm unclear on how to test this issue.

matburt commented 4 years ago

The run directive is either in /var/run or it's wherever you specify with the -d command.

Ichimonji10 commented 4 years ago

In one pane:

$ poetry run receptor --data-dir="$(mktemp --directory)" --node-id=my-node node

And in another:

$ ls -d ~/ping
ls: cannot access '/home/ichimonji10/ping': No such file or directory
$ poetry run receptor --data-dir=~/ping ping my-node --peer 127.0.0.1:8888 --count 2
{"initial_time": {"_type": "datetime.datetime", "value": 1584397276.60994}, "response_time": {"_type": "datetime.datetime", "value": 1584397276.712162}, "active_work": []}
{"initial_time": {"_type": "datetime.datetime", "value": 1584397277.611923}, "response_time": {"_type": "datetime.datetime", "value": 1584397277.714023}, "active_work": []}
$ ls -d ~/ping
/home/ichimonji10/ping
$ rm -rf ~/ping
$ ls -d ~/ping
ls: cannot access '/home/ichimonji10/ping': No such file or directory

The continued presence of the "ping" directory indicates that this issue has not been resolved.

matburt commented 4 years ago

So, actually... that directory we expect to stay around as that would be the persistent data root. Underneath that directory we create per-node directories. We couldn't actually delete that root directory without jeopardizing other running Receptor nodes.

ghjm commented 4 years ago

It's not supposed to remove ~/ping - the way you're running these commands, it's supposed to remove ~/ping/my-node. The --data-dir command specifies the top level directory (like /tmp/receptor), but the thing we're cleaning up is the node-specific directory under this.

Ichimonji10 commented 4 years ago

Gotcha! I'll re-verify with this in mind.

Ichimonji10 commented 4 years ago

I installed receptor-sleep, then executed the following in one pane:

$ poetry run receptor --data-dir="$(mktemp --directory)" --node-id=my-node node

And in another pane:

$ run_dir="$(mktemp --directory)"
$ poetry run receptor --data-dir="${run_dir}" ping my-node --count 2
{"initial_time": {"_type": "datetime.datetime", "value": 1584400344.662021}, "response_time": {"_type": "datetime.datetime", "value": 1584400344.663873}, "active_work": []}
{"initial_time": {"_type": "datetime.datetime", "value": 1584400345.663792}, "response_time": {"_type": "datetime.datetime", "value": 1584400345.766154}, "active_work": []}
$ poetry run receptor --data-dir="${run_dir}" status
Nodes:
  Myself: d5e187d7-2b2f-4d2c-ab11-e35a06efc6c6
  Others:
  - 18976285-5058-4bb5-b03e-a06235fa7a5c
  - my-node

Route Map:
- ('d5e187d7-2b2f-4d2c-ab11-e35a06efc6c6', 'my-node', 1)
- ('18976285-5058-4bb5-b03e-a06235fa7a5c', 'my-node', 100)

Known Node Capabilities:
  my-node:
    worker_versions: {}
    max_work_threads: 16
$ poetry run receptor --data-dir="${run_dir}" send --directive=receptor_sleep:execute my-node '{"duration": 5}'
No ID: iteration 1, response 1
---
$ ls -lA "${run_dir}"
total 0

This issue appears to be resolved.