Skip to content

Creating tasks with import statements fail #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anwu opened this issue Aug 10, 2022 · 1 comment · Fixed by #491
Closed

Creating tasks with import statements fail #490

anwu opened this issue Aug 10, 2022 · 1 comment · Fixed by #491
Labels
bug Something isn't working
Milestone

Comments

@anwu
Copy link

anwu commented Aug 10, 2022

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. Calling InfluxDBClient.TasksApi.create_task() with an import statement does not work.
  2. Similarly, creating a task directly using the API endpoint /api/v2/tasks with an import statement after the option task variable.
curl http://localhost:8086/api/v2/tasks \
  --header "Content-type: application/json" \
  --header "Authorization: Token INFLUX_TOKEN" \
  --data-binary @- << EOF
    {
    "orgID": "INFLUX_ORG_ID",
    "description": "IoT Center 30d environment average.",
    "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\
            import \"http\"\
            from(bucket: \"iot_center\")\
              |> range(start: -30d)\
              |> filter(fn: (r) => r._measurement == \"environment\")\
              |> aggregateWindow(every: 1h, fn: mean)"
    }
EOF

This will return an error saying that the import statement is invalid.

HTTP response body: {"code":"invalid","message":"invalid options; Err: loc 3:1-3:7: invalid statement @3:1-3:7: import: loc 3:1-3:7: invalid statement @3:1-3:7: import"}

Expected behavior:
Expected the task to be created.

Actual behavior:
HTTP response from the server saying that the "import" statement is invalid.

HOWEVER, when the import statements are placed BEFORE the "option task ..." declaration, the API call works.
The API probably needs to be fixed. But I was told that to file a ticket here and that it will be fixed via the python client library.

Specifications:

  • Client Version: 1.31.1
  • InfluxDB Version: Influx Cloud
  • Platform: Ubuntu 20.04 on WSL

Additional Info:
https://influxcommunity.slack.com/archives/CH8RV8PK5/p1659743604599309

@bednar
Copy link
Contributor

bednar commented Aug 11, 2022

Hi @anwu,

thanks for using our client.

I have prepared a fixed version within #491. If you would like to use this fixed version before regular release, please install client via:

pip install git+https://github.com/influxdata/influxdb-client-python.git@fix_create_task_with_import

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants