{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/424","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/424/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/424/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/424/events","html_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/issues/424","id":101400335,"number":424,"title":"Problem with pickle thread.lock","user":{"login":"kivio","id":1194156,"avatar_url":"https://avatars.githubusercontent.com/u/1194156?v=3","gravatar_id":"","url":"https://api.github.com/users/kivio","html_url":"https://github.com/kivio","followers_url":"https://api.github.com/users/kivio/followers","following_url":"https://api.github.com/users/kivio/following{/other_user}","gists_url":"https://api.github.com/users/kivio/gists{/gist_id}","starred_url":"https://api.github.com/users/kivio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kivio/subscriptions","organizations_url":"https://api.github.com/users/kivio/orgs","repos_url":"https://api.github.com/users/kivio/repos","events_url":"https://api.github.com/users/kivio/events{/privacy}","received_events_url":"https://api.github.com/users/kivio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-17T11:26:51Z","updated_at":"2015-08-18T07:52:23Z","closed_at":null,"body":"When i start benchmark by OpenStack driver i get:\r\n```Can't pickle <type 'thread.lock'>: it's not found as thread.lock```\r\n\r\nThis problem due from python-novaclient and objects with connection to API.\r\nMy proposition is to use dill instead of pickle for pickling.\r\nDill support ThreadLock's in proper way, benchmark with dill work's fine. I was testing it on my setup.\r\n\r\nWhat do you thing about that?"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/comments/132109689","html_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/issues/424#issuecomment-132109689","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/424","id":132109689,"user":{"login":"kivio","id":1194156,"avatar_url":"https://avatars.githubusercontent.com/u/1194156?v=3","gravatar_id":"","url":"https://api.github.com/users/kivio","html_url":"https://github.com/kivio","followers_url":"https://api.github.com/users/kivio/followers","following_url":"https://api.github.com/users/kivio/following{/other_user}","gists_url":"https://api.github.com/users/kivio/gists{/gist_id}","starred_url":"https://api.github.com/users/kivio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kivio/subscriptions","organizations_url":"https://api.github.com/users/kivio/orgs","repos_url":"https://api.github.com/users/kivio/repos","events_url":"https://api.github.com/users/kivio/events{/privacy}","received_events_url":"https://api.github.com/users/kivio/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T07:52:23Z","updated_at":"2015-08-18T07:52:23Z","body":"Another option and i think more secure (because override just Lock pickling) is use copy_reg and functions for pickle and unpickle Lock.\r\n\r\n```\r\nimport copy_reg\r\nimport thread\r\nimport threading\r\n\r\ndef pickle_lock(lock):\r\n    return threading.Lock, (lock.locked(),)\r\n\r\ndef unpickle_lock(locked, *args):\r\n    lock = threading.Lock()\r\n    if locked:\r\n        if not lock.acquire(False):\r\n            raise pickle.UnpicklingError(\"Cannot acquire lock\")\r\n\r\ncopy_reg.pickle(thread.LockType, pickle_lock, unpickle_lock)\r\n```"}}