Skip to content
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

feat: add http query interface for background tasks #13027

Merged
merged 4 commits into from
Sep 26, 2023

Conversation

ZhiHanZ
Copy link
Collaborator

@ZhiHanZ ZhiHanZ commented Sep 26, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  1. add GET /v1/background/:tenant/background_tasks http api to query background tasks
  2. allow push down table_id, timestamp, task_type, task_state from query param for more concise results

Documentation

Endpoint

GET /v1/background/:tenant/background_tasks

Description
This endpoint retrieves a list of background tasks based on the provided query parameters. If the tenant is empty, it returns an empty list of task_infos.

Path Parameters

  • tenant (String) - The tenant identifier.

Query Parameters

  • timestamp (DateTime) - Filters tasks to those updated at or after this timestamp.
  • table_id (u64) - ID of the table to filter tasks by.
  • task_state (BackgroundTaskState) - Filters tasks to those with this state. ONLY ALLOW STARTED, FAILED, DONE
  • task_type (BackgroundTaskType) - Filters tasks to those of this type. ONLY ALLOW COMPACTION or VACUUM

Response

200 OK - Successfully retrieved background tasks.
task_infos (Array) - List of tuples containing the name (String) and task info (BackgroundTaskInfo) of each task that meets the filter criteria.

500 Internal Server Error - An error occurred while processing the request.

  • Closes #issue

This change is Reviewable

@vercel
Copy link

vercel bot commented Sep 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
databend ⬜️ Ignored (Inspect) Visit Preview Sep 26, 2023 4:42pm

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Sep 26, 2023
@BohuTANG
Copy link
Member

/usr/local/bin/docker run --name ghcriokorandoruhawkeyenativev210_d65b36 --label 60e226 --workdir /github/workspace --rm -e "BUILD_PROFILE" -e "RUNNER_PROVIDER" -e "INPUT_CONFIG" -e "INPUT_MODE" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_EVENT_PATH" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "GITHUB_ACTION" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_ACTION_PATH" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/runner/_work/_temp/_github_home":"/github/home" -v "/runner/_work/_temp/_github_workflow":"/github/workflow" -v "/runner/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/runner/_work/databend/databend":"/github/workspace" ghcr.io/korandoru/hawkeye-native:v2.1.0  "check" "--config" "licenserc.toml"
[main] INFO io.korandoru.hawkeye.command.HawkEyeCommandCheck - Found missing header files: 

@ZhiHanZ ZhiHanZ merged commit 00261dc into databendlabs:main Sep 26, 2023
andylokandy pushed a commit to andylokandy/databend that referenced this pull request Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants