Categorygithub.com/prmsrswt/pipeline
modulepackage
0.2.3
Repository: https://github.com/prmsrswt/pipeline.git
Documentation: pkg.go.dev

# README

Pipeline: Atlan - Backend Engineering Intern - Task

Experimenting with pauseable, resumable tasks in a web service.

Usage

Using Docker

Run docker run -it -p 8080:8080 prmsrswt/pipeline. The API will be accessible on http://localhost:8080.

Building image yourself

  • Build the image using the provided Dockerfile.

    docker build -t pipeline .
    
  • Now you can run it using Docker.

    docker run -it -p 8080:8080 pipeline
    
  • You can now access the API on http://localhost:8080.

Building from source

  • Just run go get github.com/prmsrswt/pipeline.

  • The binary will now be available inside your $GOPATH/bin (~/go/bin in most cases). You can simply run it using ~/go/bin/pipeline.

Kubernetes

You can find example manifests in the manifests/ directory. Modify them according to your needs and deploy using kubectl create -f ./manifests.

API reference

/upload - Upload CSV file

inputdescription
fileA CSV file which will get processed
$ curl -X POST -F "file=@path/to/test.csv" http://localhost:8080/upload

{
  "status": "success",
  "data": {
    "id": "be9367c3-c492-4ce7-a256-cf4f21aa7b34"
  }
}

/status - Check status of a task

inputdescription
idThe task id of the task you want status of
$ curl -X POST -F "id=2c78e760-1c0d-414e-99a4-3ba27b76c0f0" http://localhost:8080/status

{
  "status": "success",
  "data": {
    "status": "running"
  }
}

/pause - Pause a running task

inputdescription
idThe task id of the task you want to pause
$ curl -X POST -F "id=edba118b-03db-4bbf-a94c-70f1992ff4f1" http://localhost:8080/pause

{
  "status": "success",
  "data": {
    "message": "task paused"
  }
}

/resume - Resume a paused task

inputdescription
idThe task id of the task you want to resume
$ curl -X POST -F "id=edba118b-03db-4bbf-a94c-70f1992ff4f1" http://localhost:8080/resume

{
  "status": "success",
  "data": {
    "message": "task resumed"
  }
}

/terminate - terminate a running/paused task

inputdescription
idThe task id of the task you want to terminate
$ curl -X POST -F "id=edba118b-03db-4bbf-a94c-70f1992ff4f1" http://localhost:8080/terminate

{
  "status": "success",
  "data": {
    "message": "task terminated"
  }
}

# Packages

No description provided by the author

# Functions

Asset loads and returns the asset for the given name.
AssetDir returns the file names below a certain directory embedded in the file by go-bindata.
AssetInfo loads and returns the asset info for the given name.
AssetNames returns the names of the assets.
MustAsset is like Asset but panics when Asset would return an error.
RestoreAsset restores an asset under the given directory.
RestoreAssets restores an asset under the given directory recursively.