data.gov icon indicating copy to clipboard operation
data.gov copied to clipboard

[2d] Integrate cf-python-client into datagov-harvesting-logic and explore task support

Open btylerburton opened this issue 10 months ago • 3 comments

Purpose

In order to interact with tasks in our cloud.gov space, datagovteam wants to integrate the a python based Cloud Foundry client and create an interface for necessary operations.

Initially we had looked into python-cf-api, but the fact that it hasn't been updated in 4+yrs and this issue being posted in 2022 and still unanswered gives me pause:

  • https://github.com/hsdp/python-cf-api/issues/8 🔥

A quick search found the library below, which has much more recent activity, was developed by the cloudfoundry community, and specifically addresses our issue of running a task:

  • https://github.com/cloudfoundry-community/cf-python-client/issues/99#issuecomment-645590111

Given the above uncertainty, conducting investigation & prototyping is needed to provide factual knowledge on future steps.

2d of effort has been allocated, and once compete, findings will be demonstrated and specific future actions will be decided.

Acceptance Criteria

[ACs should be clearly demo-able/verifiable whenever possible. Try specifying them using BDD.]

  • [ ] GIVEN the cf-python-client has been integrated into a branch on datagov-harvesting-logic AND the tasks from the sketch below have been attempted WHEN 2d has elapsed THEN the assignee will present their findings to datagovteam AND we will collectively decide if this library will serve our needs.

Background

Datagovteam seeks a reliable way to interact with applications in cloud foundry. Ideally this can be performed from our python-flask app. The actions we need to perform are:

  • cf run-task APP-NAME --name TASK-NAME
  • cf tasks APP-NAME

Sketch

  • [ ] Integrate cf-python-client into harvesting-logic
  • [ ] Attempt to run task commands on datgov-harvesting-logic-runner
    • [ ] cf run-task APP-NAME --name TASK-NAME
    • [ ] cf tasks APP-NAME
  • [ ] Capture logs of the above operations

btylerburton avatar Mar 28 '24 23:03 btylerburton

cf-python-client task creation

rshewitt avatar Apr 01 '24 17:04 rshewitt

active branch

rshewitt avatar Apr 01 '24 21:04 rshewitt

an exception is thrown when you attempt to cancel a task that has already succeeded. Task state is SUCCEEDED and therefore cannot be canceled

rshewitt avatar Apr 02 '24 15:04 rshewitt