{"action":"created","comment":{"url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments/57137799","id":57137799,"diff_hunk":"@@ -0,0 +1,272 @@\n+########################################################################\n+# $Id: $\n+########################################################################\n+\n+\"\"\"\n+This class a wrapper around elasticsearch-py. It is used to query\n+Elasticsearch database.\n+\n+\"\"\"\n+\n+__RCSID__ = \"$Id$\"\n+\n+from DIRAC                      import gLogger, S_OK, S_ERROR\n+from elasticsearch              import Elasticsearch\n+from elasticsearch_dsl          import Search, Q, A\n+from elasticsearch.exceptions   import ConnectionError, TransportError, NotFoundError\n+from elasticsearch.helpers      import BulkIndexError\n+from elasticsearch              import helpers\n+from datetime                   import datetime\n+from DIRAC.Core.Utilities       import Time\n+\n+class ElasticSearchDB( object ):\n+  \n+  \"\"\"\n+  .. class:: ElasticSearchDB\n+\n+  :param str url: the url to the database for example: el.cern.ch:9200\n+  :param str gDebugFile: is used to save the debug information to a file\n+  \"\"\"\n+  __chunk_size = 1000\n+  __url = \"\"\n+  ########################################################################\n+  def __init__( self, host, port, debug = False ):\n+    \"\"\" c'tor\n+    :param self: self reference\n+    :param str host: name of the database for example: MonitoringDB\n+    :param str port: The full name of the database for example: 'Monitoring/MonitoringDB'\n+    :param bool debug: save the debug information to a file   \n+    \"\"\"\n+    global gDebugFile\n+    \n+    if 'log' not in dir( self ):\n+      self.log = gLogger.getSubLogger( 'ElasticSearch' )\n+    self.logger = self.log\n+    \n+    self.__url = \"http://%s:%s\" % ( host, port )\n+        \n+    if debug:\n+      try:\n+        gDebugFile = open( \"%s.debug.log\" % self.__dbName, \"w\" )\n+      except IOError as e:\n+        self.log.error( e )","path":"Core/Utilities/ElasticSearchDB.py","position":52,"original_position":52,"commit_id":"3aec773bfe2e5f68ac66b5ca0bd32972fc3acdae","original_commit_id":"3aec773bfe2e5f68ac66b5ca0bd32972fc3acdae","user":{"login":"zmathe","id":981448,"avatar_url":"https://avatars.githubusercontent.com/u/981448?v=3","gravatar_id":"","url":"https://api.github.com/users/zmathe","html_url":"https://github.com/zmathe","followers_url":"https://api.github.com/users/zmathe/followers","following_url":"https://api.github.com/users/zmathe/following{/other_user}","gists_url":"https://api.github.com/users/zmathe/gists{/gist_id}","starred_url":"https://api.github.com/users/zmathe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmathe/subscriptions","organizations_url":"https://api.github.com/users/zmathe/orgs","repos_url":"https://api.github.com/users/zmathe/repos","events_url":"https://api.github.com/users/zmathe/events{/privacy}","received_events_url":"https://api.github.com/users/zmathe/received_events","type":"User","site_admin":false},"body":"This is for debugging specific problem.","created_at":"2016-03-23T10:34:59Z","updated_at":"2016-03-23T10:34:59Z","html_url":"https://github.com/DIRACGrid/DIRAC/pull/2864#discussion_r57137799","pull_request_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864","_links":{"self":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments/57137799"},"html":{"href":"https://github.com/DIRACGrid/DIRAC/pull/2864#discussion_r57137799"},"pull_request":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864"}}},"pull_request":{"url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864","id":63727372,"html_url":"https://github.com/DIRACGrid/DIRAC/pull/2864","diff_url":"https://github.com/DIRACGrid/DIRAC/pull/2864.diff","patch_url":"https://github.com/DIRACGrid/DIRAC/pull/2864.patch","issue_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2864","number":2864,"state":"open","locked":false,"title":"[v6r16] New monitoring system","user":{"login":"zmathe","id":981448,"avatar_url":"https://avatars.githubusercontent.com/u/981448?v=3","gravatar_id":"","url":"https://api.github.com/users/zmathe","html_url":"https://github.com/zmathe","followers_url":"https://api.github.com/users/zmathe/followers","following_url":"https://api.github.com/users/zmathe/following{/other_user}","gists_url":"https://api.github.com/users/zmathe/gists{/gist_id}","starred_url":"https://api.github.com/users/zmathe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmathe/subscriptions","organizations_url":"https://api.github.com/users/zmathe/orgs","repos_url":"https://api.github.com/users/zmathe/repos","events_url":"https://api.github.com/users/zmathe/events{/privacy}","received_events_url":"https://api.github.com/users/zmathe/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-22T14:21:26Z","updated_at":"2016-03-23T10:34:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864/commits","review_comments_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864/comments","review_comment_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2864/comments","statuses_url":"https://api.github.com/repos/DIRACGrid/DIRAC/statuses/3aec773bfe2e5f68ac66b5ca0bd32972fc3acdae","head":{"label":"zmathe:el_monitoring","ref":"el_monitoring","sha":"3aec773bfe2e5f68ac66b5ca0bd32972fc3acdae","user":{"login":"zmathe","id":981448,"avatar_url":"https://avatars.githubusercontent.com/u/981448?v=3","gravatar_id":"","url":"https://api.github.com/users/zmathe","html_url":"https://github.com/zmathe","followers_url":"https://api.github.com/users/zmathe/followers","following_url":"https://api.github.com/users/zmathe/following{/other_user}","gists_url":"https://api.github.com/users/zmathe/gists{/gist_id}","starred_url":"https://api.github.com/users/zmathe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmathe/subscriptions","organizations_url":"https://api.github.com/users/zmathe/orgs","repos_url":"https://api.github.com/users/zmathe/repos","events_url":"https://api.github.com/users/zmathe/events{/privacy}","received_events_url":"https://api.github.com/users/zmathe/received_events","type":"User","site_admin":false},"repo":{"id":2210861,"name":"DIRAC","full_name":"zmathe/DIRAC","owner":{"login":"zmathe","id":981448,"avatar_url":"https://avatars.githubusercontent.com/u/981448?v=3","gravatar_id":"","url":"https://api.github.com/users/zmathe","html_url":"https://github.com/zmathe","followers_url":"https://api.github.com/users/zmathe/followers","following_url":"https://api.github.com/users/zmathe/following{/other_user}","gists_url":"https://api.github.com/users/zmathe/gists{/gist_id}","starred_url":"https://api.github.com/users/zmathe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmathe/subscriptions","organizations_url":"https://api.github.com/users/zmathe/orgs","repos_url":"https://api.github.com/users/zmathe/repos","events_url":"https://api.github.com/users/zmathe/events{/privacy}","received_events_url":"https://api.github.com/users/zmathe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zmathe/DIRAC","description":"DIRAC Grid","fork":true,"url":"https://api.github.com/repos/zmathe/DIRAC","forks_url":"https://api.github.com/repos/zmathe/DIRAC/forks","keys_url":"https://api.github.com/repos/zmathe/DIRAC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zmathe/DIRAC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zmathe/DIRAC/teams","hooks_url":"https://api.github.com/repos/zmathe/DIRAC/hooks","issue_events_url":"https://api.github.com/repos/zmathe/DIRAC/issues/events{/number}","events_url":"https://api.github.com/repos/zmathe/DIRAC/events","assignees_url":"https://api.github.com/repos/zmathe/DIRAC/assignees{/user}","branches_url":"https://api.github.com/repos/zmathe/DIRAC/branches{/branch}","tags_url":"https://api.github.com/repos/zmathe/DIRAC/tags","blobs_url":"https://api.github.com/repos/zmathe/DIRAC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zmathe/DIRAC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zmathe/DIRAC/git/refs{/sha}","trees_url":"https://api.github.com/repos/zmathe/DIRAC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zmathe/DIRAC/statuses/{sha}","languages_url":"https://api.github.com/repos/zmathe/DIRAC/languages","stargazers_url":"https://api.github.com/repos/zmathe/DIRAC/stargazers","contributors_url":"https://api.github.com/repos/zmathe/DIRAC/contributors","subscribers_url":"https://api.github.com/repos/zmathe/DIRAC/subscribers","subscription_url":"https://api.github.com/repos/zmathe/DIRAC/subscription","commits_url":"https://api.github.com/repos/zmathe/DIRAC/commits{/sha}","git_commits_url":"https://api.github.com/repos/zmathe/DIRAC/git/commits{/sha}","comments_url":"https://api.github.com/repos/zmathe/DIRAC/comments{/number}","issue_comment_url":"https://api.github.com/repos/zmathe/DIRAC/issues/comments{/number}","contents_url":"https://api.github.com/repos/zmathe/DIRAC/contents/{+path}","compare_url":"https://api.github.com/repos/zmathe/DIRAC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zmathe/DIRAC/merges","archive_url":"https://api.github.com/repos/zmathe/DIRAC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zmathe/DIRAC/downloads","issues_url":"https://api.github.com/repos/zmathe/DIRAC/issues{/number}","pulls_url":"https://api.github.com/repos/zmathe/DIRAC/pulls{/number}","milestones_url":"https://api.github.com/repos/zmathe/DIRAC/milestones{/number}","notifications_url":"https://api.github.com/repos/zmathe/DIRAC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zmathe/DIRAC/labels{/name}","releases_url":"https://api.github.com/repos/zmathe/DIRAC/releases{/id}","deployments_url":"https://api.github.com/repos/zmathe/DIRAC/deployments","created_at":"2011-08-15T16:50:01Z","updated_at":"2014-06-13T16:40:38Z","pushed_at":"2016-03-22T15:39:37Z","git_url":"git://github.com/zmathe/DIRAC.git","ssh_url":"git@github.com:zmathe/DIRAC.git","clone_url":"https://github.com/zmathe/DIRAC.git","svn_url":"https://github.com/zmathe/DIRAC","homepage":"http://diracgrid.org","size":29407,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"integration"}},"base":{"label":"DIRACGrid:integration","ref":"integration","sha":"860fd1dfbf1e0d584a517d2e52adc397f7a2c9e6","user":{"login":"DIRACGrid","id":694842,"avatar_url":"https://avatars.githubusercontent.com/u/694842?v=3","gravatar_id":"","url":"https://api.github.com/users/DIRACGrid","html_url":"https://github.com/DIRACGrid","followers_url":"https://api.github.com/users/DIRACGrid/followers","following_url":"https://api.github.com/users/DIRACGrid/following{/other_user}","gists_url":"https://api.github.com/users/DIRACGrid/gists{/gist_id}","starred_url":"https://api.github.com/users/DIRACGrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DIRACGrid/subscriptions","organizations_url":"https://api.github.com/users/DIRACGrid/orgs","repos_url":"https://api.github.com/users/DIRACGrid/repos","events_url":"https://api.github.com/users/DIRACGrid/events{/privacy}","received_events_url":"https://api.github.com/users/DIRACGrid/received_events","type":"Organization","site_admin":false},"repo":{"id":1576831,"name":"DIRAC","full_name":"DIRACGrid/DIRAC","owner":{"login":"DIRACGrid","id":694842,"avatar_url":"https://avatars.githubusercontent.com/u/694842?v=3","gravatar_id":"","url":"https://api.github.com/users/DIRACGrid","html_url":"https://github.com/DIRACGrid","followers_url":"https://api.github.com/users/DIRACGrid/followers","following_url":"https://api.github.com/users/DIRACGrid/following{/other_user}","gists_url":"https://api.github.com/users/DIRACGrid/gists{/gist_id}","starred_url":"https://api.github.com/users/DIRACGrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DIRACGrid/subscriptions","organizations_url":"https://api.github.com/users/DIRACGrid/orgs","repos_url":"https://api.github.com/users/DIRACGrid/repos","events_url":"https://api.github.com/users/DIRACGrid/events{/privacy}","received_events_url":"https://api.github.com/users/DIRACGrid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DIRACGrid/DIRAC","description":"DIRAC Grid","fork":false,"url":"https://api.github.com/repos/DIRACGrid/DIRAC","forks_url":"https://api.github.com/repos/DIRACGrid/DIRAC/forks","keys_url":"https://api.github.com/repos/DIRACGrid/DIRAC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DIRACGrid/DIRAC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DIRACGrid/DIRAC/teams","hooks_url":"https://api.github.com/repos/DIRACGrid/DIRAC/hooks","issue_events_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/events{/number}","events_url":"https://api.github.com/repos/DIRACGrid/DIRAC/events","assignees_url":"https://api.github.com/repos/DIRACGrid/DIRAC/assignees{/user}","branches_url":"https://api.github.com/repos/DIRACGrid/DIRAC/branches{/branch}","tags_url":"https://api.github.com/repos/DIRACGrid/DIRAC/tags","blobs_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/refs{/sha}","trees_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DIRACGrid/DIRAC/statuses/{sha}","languages_url":"https://api.github.com/repos/DIRACGrid/DIRAC/languages","stargazers_url":"https://api.github.com/repos/DIRACGrid/DIRAC/stargazers","contributors_url":"https://api.github.com/repos/DIRACGrid/DIRAC/contributors","subscribers_url":"https://api.github.com/repos/DIRACGrid/DIRAC/subscribers","subscription_url":"https://api.github.com/repos/DIRACGrid/DIRAC/subscription","commits_url":"https://api.github.com/repos/DIRACGrid/DIRAC/commits{/sha}","git_commits_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/commits{/sha}","comments_url":"https://api.github.com/repos/DIRACGrid/DIRAC/comments{/number}","issue_comment_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/comments{/number}","contents_url":"https://api.github.com/repos/DIRACGrid/DIRAC/contents/{+path}","compare_url":"https://api.github.com/repos/DIRACGrid/DIRAC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DIRACGrid/DIRAC/merges","archive_url":"https://api.github.com/repos/DIRACGrid/DIRAC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DIRACGrid/DIRAC/downloads","issues_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues{/number}","pulls_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls{/number}","milestones_url":"https://api.github.com/repos/DIRACGrid/DIRAC/milestones{/number}","notifications_url":"https://api.github.com/repos/DIRACGrid/DIRAC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DIRACGrid/DIRAC/labels{/name}","releases_url":"https://api.github.com/repos/DIRACGrid/DIRAC/releases{/id}","deployments_url":"https://api.github.com/repos/DIRACGrid/DIRAC/deployments","created_at":"2011-04-06T11:47:53Z","updated_at":"2016-03-09T10:17:10Z","pushed_at":"2016-03-22T15:39:37Z","git_url":"git://github.com/DIRACGrid/DIRAC.git","ssh_url":"git@github.com:DIRACGrid/DIRAC.git","clone_url":"https://github.com/DIRACGrid/DIRAC.git","svn_url":"https://github.com/DIRACGrid/DIRAC","homepage":"http://diracgrid.org","size":31779,"stargazers_count":47,"watchers_count":47,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"open_issues_count":111,"forks":90,"open_issues":111,"watchers":47,"default_branch":"integration"}},"_links":{"self":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864"},"html":{"href":"https://github.com/DIRACGrid/DIRAC/pull/2864"},"issue":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2864"},"comments":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2864/comments"},"review_comments":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864/comments"},"review_comment":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2864/commits"},"statuses":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/statuses/3aec773bfe2e5f68ac66b5ca0bd32972fc3acdae"}}}}