{"id":18497650,"url":"https://github.com/centreon/pywarp10","last_synced_at":"2025-04-09T00:30:38.629Z","repository":{"id":40248588,"uuid":"376084142","full_name":"centreon/pywarp10","owner":"centreon","description":"Makes it easy to work with warp10 database","archived":false,"fork":false,"pushed_at":"2025-04-07T14:31:33.000Z","size":253,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-07T15:34:22.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/centreon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-11T16:32:39.000Z","updated_at":"2025-03-27T10:04:22.000Z","dependencies_parsed_at":"2023-11-15T22:40:21.184Z","dependency_job_id":"420e78ae-8956-453c-a5e8-36dbe6b98096","html_url":"https://github.com/centreon/pywarp10","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fpywarp10","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fpywarp10/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fpywarp10/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fpywarp10/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centreon","download_url":"https://codeload.github.com/centreon/pywarp10/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949659,"owners_count":21023364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T13:35:13.534Z","updated_at":"2025-04-09T00:30:38.300Z","avatar_url":"https://github.com/centreon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![coverage](assets/coverage.svg)\n\n# pywarp10\n\nMakes it easier to work with warp10 in python. The [Warp 10 platform](https://warp10.io)\nis built to simplify managing and processing Time Series data. It includes a Geo Time\nSeries database and a companion analytics engine.\n\n# Motivation\n\nThe Warp10 platform can already interact with python using the\n[`py4j`](https://www.py4j.org/) module. The documentation can be found\n[here](https://www.warp10.io/content/03_Documentation/04__Tooling/03_Python). Few blog\nposts are also written to detail the use of this module: [The Py4J plugin for Warp\n10](https://blog.senx.io/the-py4j-plugin-for-warp-10/) or [WarpScript for\nPythonists](https://blog.senx.io/warpscript-for-pythonists/) for instance.\n\nPy4J is a low level tool which needs to be configured in order to work with warp10: the\ncreation of the gateway, the entry point and handling the stack is all done manually.\nMoreover, all objects are not recognised directly: GTS cannot be transformed directly to\na python object with py4j and user must first transform the GTS into a\n[PICKLE](https://www.warp10.io/doc/AItFHJCAI3J) object,\n[ARROW](https://blog.senx.io/conversions-to-apache-arrow-format/) object or a MAP in\norder to be correctly read with python.\n\nThis module aims to expose some handy tools in order to work with warp10 database\nwithout dealing with configurations and object transformations.\n\n# Examples\n\nThe module exposes the `Warpscript` object with some useful methods:\n\n```python\nfrom pywarp10 import Warpscript\n\n# The address and the port to connect to the Warp10 server can either be passed in the\n# object parameter or by setting environment variables: WARP10_HOST and WARP10_PORT.\nws = Warpscript(host=\"127.0.0.1\", port=25333)\n\n# Script\n# ------\n\n# The `script` constructs WarpScript by translating python parameters into WarpScript.\n# The optional parameter `fun` is used to add a WarpScript function at the end of the\n# script.\n#\n# Durations, dates and datetime are automatically parsed using `dateparser` and \n# `durations` python modules.\n\npython_object = {\n    \"token\": \"some-token\",\n    \"class\": \"classname\",\n    \"labels\": {},\n    \"end\", \"1 day ago\",\n    \"count\": 1,\n}\nws.script(python_object, fun = \"FETCH\")\n# \u003e { \n# \u003e   'token' 'some-token' \n# \u003e   'class' 'class' \n# \u003e   'end' '2021-06-16T12:15:15.684532Z'\n# \u003e   'count' 1 \n# \u003e } FETCH\n\n\n# Multiple scripts can be chained together.\n# The `ws:` prefix to a string indicates that the string should not be sanitized (i.e.\n# the string should not be surrounded by single quotes in the warpscript).\n\nbucketize = [\"ws:SWAP\", \"ws:bucketizer.mean\", 0, \"1 h\", 0]\nws.script(bucketize, fun = \"BUCKETIZE\")\n# \u003e { \n# \u003e   'token' 'some-token' \n# \u003e   'class' 'class' \n# \u003e   'end' '2021-06-16T12:15:15.684532Z'\n# \u003e   'count' 100 \n# \u003e } FETCH\n# \u003e [ SWAP bucketizer.mean 0 3600 0 ] BUCKETIZE\n\n# Exec\n# ----\n\n# The `exec` method execute warpscript build with script on the warp10 server and\n# returns the corresponding python objects, including GTS and LGTS which are \n# automatically transformed into pandas dataframe.\n# Once a warpscript is executed, the stack is cleared and the gateway is closed. A new\n# one is opened for another execution.\n\nws.exec()\n# \u003e            timestamps  traffic_in service_name          _source     host_name \n# \u003e 0 2020-10-28 00:00:00  6127530.00 some-service         centreon     some-host \n# \u003e 1 2020-11-16 16:00:00  6871267.68          NaN           client           NaN \n# \u003e 2 2020-11-16 16:00:00  6871267.68 some-service         centreon     some-host \n# \u003e 3 2021-04-30 16:00:00  9158182.05 some-service           client     some-host\n\n# In the last example, the FETCH-BUCKETIZE produced a list of GTS. The resulting\n# dataframe has at least two columns: `timestamps` and `values` where the value column\n# is named after the classname.\n# All the other columns are labels that differ in at least one GTS from the list of GTS.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentreon%2Fpywarp10","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentreon%2Fpywarp10","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentreon%2Fpywarp10/lists"}