{"action":"created","issue":{"url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/256","repository_url":"https://api.github.com/repos/ckan/ckanext-harvest","labels_url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/256/comments","events_url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/256/events","html_url":"https://github.com/ckan/ckanext-harvest/issues/256","id":164088492,"number":256,"title":"Ckan Harvester does not delete resources","user":{"login":"bunnis","id":12037512,"avatar_url":"https://avatars.githubusercontent.com/u/12037512?v=3","gravatar_id":"","url":"https://api.github.com/users/bunnis","html_url":"https://github.com/bunnis","followers_url":"https://api.github.com/users/bunnis/followers","following_url":"https://api.github.com/users/bunnis/following{/other_user}","gists_url":"https://api.github.com/users/bunnis/gists{/gist_id}","starred_url":"https://api.github.com/users/bunnis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bunnis/subscriptions","organizations_url":"https://api.github.com/users/bunnis/orgs","repos_url":"https://api.github.com/users/bunnis/repos","events_url":"https://api.github.com/users/bunnis/events{/privacy}","received_events_url":"https://api.github.com/users/bunnis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-06T14:25:08Z","updated_at":"2016-07-06T15:53:45Z","closed_at":null,"body":"Hi\r\nDeleting all datasets harvested with the 'Clear' button on the admin page does not erase the resource files. I tried to add the following code on https://github.com/ckan/ckanext-harvest/blob/master/ckanext/harvest/logic/action/update.py#L105\r\n\r\nThe problem is that this takes too long and triggers a package_update (called from resource_delete). Also, since I have a lots of resources (5k +) I'm not sure they are getting deleted from the filesystem even with my method. This may be the right way of doing it but I think the correct way should be something that triggers the file deletion.\r\n\r\n```\r\n    # Clear all resources associated with the datasets\r\n    q='harvest_source_id:'+str(harvest_source_id)\r\n    \r\n    i=0\r\n    results_source_id = toolkit.get_action('package_search')(context, {'q':q,'rows':20000})\r\n    print \"starting deleting resources\"\r\n\r\n        \r\n    for result_del in results_source_id['results']:\r\n        #print i\r\n        for resource_del in result_del['resources']:\r\n            toolkit.get_action('resource_delete')(context, {'id':resource_del['id']})\r\n        i=i+1\r\n    print \"done deleting resources\"\r\n```"},"comment":{"url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/comments/230816214","html_url":"https://github.com/ckan/ckanext-harvest/issues/256#issuecomment-230816214","issue_url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/256","id":230816214,"user":{"login":"metaodi","id":538415,"avatar_url":"https://avatars.githubusercontent.com/u/538415?v=3","gravatar_id":"","url":"https://api.github.com/users/metaodi","html_url":"https://github.com/metaodi","followers_url":"https://api.github.com/users/metaodi/followers","following_url":"https://api.github.com/users/metaodi/following{/other_user}","gists_url":"https://api.github.com/users/metaodi/gists{/gist_id}","starred_url":"https://api.github.com/users/metaodi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metaodi/subscriptions","organizations_url":"https://api.github.com/users/metaodi/orgs","repos_url":"https://api.github.com/users/metaodi/repos","events_url":"https://api.github.com/users/metaodi/events{/privacy}","received_events_url":"https://api.github.com/users/metaodi/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T15:53:44Z","updated_at":"2016-07-06T15:53:44Z","body":"@bunnis good point. Please be aware that `resource_delete` does **not** delete the file in the FileStore. In order to do that, you need to call `resource_update` with the `clear` parameter."}}
{"actor":{"display_login":"metaodi"}}