Skip to content

Aws batch hillshade - #2

Open
MDavidson17 wants to merge 6 commits into
masterfrom
aws-batch-hillshade
Open

Aws batch hillshade#2
MDavidson17 wants to merge 6 commits into
masterfrom
aws-batch-hillshade

Conversation

@MDavidson17

Copy link
Copy Markdown

batch process to create hillshades.

not included:

  • ci
  • testing

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# install awscli
RUN apt update && apt install awscli -y

@blacha blacha Aug 31, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combine apt installs into one install apt install awscli jq -y

its also a good idea to clean up the packages after install, I cant remember the exact command but its something like && apt-cache-clean

@@ -0,0 +1,32 @@
#!/bin/bash
cd ./app
tmp_dir=$(mktemp -d -t hs-XXXXXXXXXX)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally use long form arguments to make it easier to read -d vs --directory

@@ -0,0 +1,63 @@
import cdk = require('@aws-cdk/core');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never use require

import * as cdk from '@aws-cdk/core

let string = ''
for await (let file_name of fsa.list(ReadFromFolder)) {
// let re = /\ /gi;
// file_name = file_name.replace(re, '\\ ')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be a good idea to simplify this down

const goodExtension = new Set('tif', 'tiff', 'asc')
cosnt ext = extname(file_name)

if (ext in file_extensions) {
   file_name.replace(ext, 'tiff')
}

fileList = fileList.concat(string)
count++
}
if (count == 25) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const RecordsPerJob = 25

if (fileList.length >= RecordsPerJob)

}
}
if (count > 0) {
submit(correlationId, "final-upload-" + upload_count, fileList)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await

let base = ''
let string = ''
for await (let file_name of fsa.list(ReadFromFolder)) {
// let re = /\ /gi;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The escaping is a problem in bash, I would leave these names alone

added await submit
fix handling of file list 
convert to python script
tidy up and delete temp_dir
added logging
replaced by python script

@paulfouquet paulfouquet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the script work with the bad indentation?

os.environ["AWS_SECRET_ACCESS_KEY"]=credentials['SecretAccessKey']
os.environ["AWS_SESSION_TOKEN"]=credentials['SessionToken']

temp_dir = tempfile.mkdtemp()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is weird here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants