Skip to content

Commit

Permalink
Merge pull request #64 from dragondrop-cloud/feature/pull_out_nlp_scr…
Browse files Browse the repository at this point in the history
…ipt_II

Integrate cloud-concierge container with remote NLPEngine Endpoint
  • Loading branch information
GoodmanBen authored Sep 10, 2023
2 parents 2cb9d59 + b955e37 commit a3430d7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 319 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nlpengine-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:

- name: 'Deploy cloud function dev'
if: ${{ github.ref_name == 'dev'}}
run: 'gcloud functions deploy nlpengine-endpoint-dev --gen2 --runtime=python311 --region=us-east4 --source=nlpengine/ --entry-point=train_and_predict --trigger-http --allow-unauthenticated --memory=2048MB --timeout=600s --set-env-vars=DRAGONDROP_API_URL=https://api.dev-dragondrop.cloud --max-instances=10'
run: 'gcloud functions deploy nlpengine-endpoint-dev --gen2 --runtime=python311 --region=us-east4 --source=nlpengine/ --entry-point=train_and_predict --trigger-http --allow-unauthenticated --memory=4096MB --timeout=600s --set-env-vars=DRAGONDROP_API_URL=https://api.dev-dragondrop.cloud --max-instances=10'

- name: 'Deploy cloud function prod'
if: ${{ github.ref_name == 'prod'}}
run: 'gcloud functions deploy nlpengine-endpoint-prod --gen2 --runtime=python311 --region=us-east4 --source=nlpengine/ --entry-point=train_and_predict --trigger-http --allow-unauthenticated --memory=2048MB --timeout=600s --set-env-vars=DRAGONDROP_API_URL=https://api.dragondrop.cloud'
run: 'gcloud functions deploy nlpengine-endpoint-prod --gen2 --runtime=python311 --region=us-east4 --source=nlpengine/ --entry-point=train_and_predict --trigger-http --allow-unauthenticated --memory=4096MB --timeout=600s --set-env-vars=DRAGONDROP_API_URL=https://api.dragondrop.cloud'
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"fmt"
"io"
"os"

log "github.com/sirupsen/logrus"
)

// AuthorizeJob Checks with DragonDropAPI for valid auth of the current job, for an oss job
Expand Down Expand Up @@ -72,29 +74,28 @@ func (c *HTTPDragonDropClient) PostNLPEngine(ctx context.Context) error {
fmt.Sprintf("%v", c.config.NLPEndpoint),
bytes.NewBuffer(jsonBody),
)

if err != nil {
return fmt.Errorf("[post_nlp_engine][error in newRequest]%w", err)
}

log.Info("Sending request to NLP engine...")
response, err := c.httpClient.Do(request)

if err != nil {
return fmt.Errorf("[post_nlp_engine] error in http POST request]%w", err)
}

defer response.Body.Close()
if response.StatusCode != 200 {
if response.StatusCode != 201 {
return fmt.Errorf("[post_nlp_engine][was unsuccessful, with the server returning: %v]", response.StatusCode)
}
log.Info("NLP engine completed successfully.")

// Read response body into a string
body, err := io.ReadAll(response.Body)
if err != nil {
return fmt.Errorf("[error reading response body]%v", err)
}
// TODO: remove once done integration testing
fmt.Printf("response body: %v", string(body))

err = os.WriteFile("outputs/new-resources-to-workspace.json", body, 0400)
if err != nil {
return fmt.Errorf("[error writing new-resources-to-workspace.json]%v", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func NewLogQuerier(globalConfig Config, provider terraformValueObjects.Provider)
}
}

// TODO: Update unit tests to include the createtags action
// determineActionClass determines the classification of an input method, which is either a resource
// "modification", "creation", "deletion", or "not_classified".
func determineActionClass(value string) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (i *TerraformImportMigrationGenerator) Execute(ctx context.Context) error {
return fmt.Errorf("[terraform_import_migration_generator][error informing resources mapped to import location]%w", err)
}

// TODO: Major refactor needed here
resourceImportMapJSON, err := i.convertProviderToResourceImportMapToJSON(resourceImports)
if err != nil {
return fmt.Errorf("[terraform_import_migration_generator][error converting Provider to resource import]%w", err)
Expand Down
Empty file.
310 changes: 0 additions & 310 deletions main/internal/python_scripts/nlpengine/main.py

This file was deleted.

0 comments on commit a3430d7

Please sign in to comment.