sagemaker.estimator.Estimator containers eu-west-2 - amazon-sagemaker

Looking at this, specifically:
containers = {'us-west-2': '433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest',
'us-east-1': '811284229777.dkr.ecr.us-east-1.amazonaws.com/xgboost:latest',
'us-east-2': '825641698319.dkr.ecr.us-east-2.amazonaws.com/xgboost:latest',
'eu-west-1': '685385470294.dkr.ecr.eu-west-1.amazonaws.com/xgboost:latest'}
sess = sagemaker.Session()
xgb = sagemaker.estimator.Estimator(containers[boto3.Session().region_name],
role,
instance_count=1,
instance_type='ml.m4.xlarge',
output_path='s3://{}/{}/output'.format(bucket, prefix),
sagemaker_session=sess)
where do these entries (contain image names?):
'685385470294.dkr.ecr.eu-west-1.amazonaws.com/xgboost:latest'
come from? I am especially after a eu-west-2 one - hope there is one (-: Thanks!
PS:
It may be that I can just run - at run time?:
from sagemaker import image_uris
image_uris.retrieve(framework='xgboost', region='eu-west-2', version='latest')

I'm not an expert, but those are the container registry path and you can find the full list here.

Yes.
You can use this code snippet:
from sagemaker import image_uris
image_uris.retrieve(framework='xgboost', region='eu-west-2', version='latest')
and it will give you this value:
644912444149.dkr.ecr.eu-west-2.amazonaws.com/xgboost:latest
This is the latest version of the container but it not recommended to run in prod environments.
https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html

Related

GlobalWorkerOptions of undefined for a React-Typescipt-Electron app

I'm trying to use pdfjs-dist's example for a Typescript-React-Electron app.
import pdfjsLib from 'pdfjs-dist';
pdfjsLib.GlobalWorkerOptions.workerSrc = 'src/node_modules/pdfjs-
dist/build/pdf.worker.js';
I get GlobalWorkerOptions of undefined.
Based on what I found here
in package.json I've put:
"source": "src/app/components/pdfHandling/entry/entry.js",
where src/app/components/pdfHandling/entry/entry.js:
import * as pdfjs from 'pdfjs-dist';
pdfjs.GlobalWorkerOptions.workerSrc = 'pdf.worker.js';
export {
pdfjs,
};
I posted the same problem in Mozilla's GitHub. And this is the answer I received:
The standalone examples in our repository work, so this must be some
integration issue with React/Electron, for which we cannot provide
assistance since we're not familiar with them. I would suggest to ask
on StackOverflow or other React/Electron-specific forums instead.
Any ideas about how to make pdfjs.GlobalWorkerOptions working?
The problem was silly and subtle....
It is enough to substitute
import * as pdfjs from 'pdfjs-dist';
with
var pdfjsLib = require("pdfjs-dist");
to make the problem disappearing....

Use variable language specific strings in hugo config file

My goal is to build a multilingual site using hugo. For this I would like to:
not touch the theme file
have a config file which defines the overall structure for all languages (config.toml)
have a "string" file for all languages
So for example, I would have a config.toml file like this:
[params.navigation]
brand = "out-website"
[params.navigation.links]
about = $ABOUT_NAME
services = $SERVICES_NAME
team = $TEAM_NAME
impressum = $IMPRESSUM_NAME
a english language file:
ABOUT_NAME=About
SERVICES_NAME=Services
TEAM_NAME=Team
IMPRESSUM_NAME=Impressum
and a german language file like this:
ABOUT_NAME=Über uns
SERVICES_NAME=Dienste
TEAM_NAME=Mitarbeiter
IMPRESSUM_NAME=Impressum
And then I want to compile the project for english, I do something along the line of:
hugo --theme=... --config=config.toml --config=english.toml
and german:
hugo --theme=... --config=config.toml --config=german.toml
Or in same similar way.
For this I need to use variables in the config.toml that are defined in english.toml or german.toml
My google search so far say, that I cannot use variables in toml.
So is there a different approach with which I could achieve this?
Your approach with variables is not optimal, use the tutorial below.
Multilingual sites are coming as a feature on Hugo 0.16, but I managed to build a multilingual site on current Hugo using this tutorial and some hacks.
The tutorial above requires to "have a separate domain name for each language". I managed to bypass that and to have to sites, one at root (EN), and one in the folder (/LT/).
Here are the steps I used.
Set up reliable build runner, you can use Grunt/Gulp, but I used npm scripts. I hacked npm-build-boilerplate and outsourced rendering from Hugo. Hugo is used only to generate files. This is important, because 1) we will be generating two sites; 2) hacks will require operations on folders, what is easy on npm (I'm not proficient on building custom Grunt/Gulp scripts).
Set up config_en.toml and config_de.toml in root folder as per tutorial.
Here's excerpt from my config_en.toml:
contentdir = "content/en"
publishdir = "public"
Here's excerpt from my config_lt.toml (change it to DE in your case):
contentdir = "content/lt"
publishdir = "public/lt"
Basically, I want my website.com to show EN version, and website.com/lt/ to show LT version. This deviates from tutorial and will require hacks.
Set up translations in /data folder as per tutorial.
Bonus: set up snippet on Dash:
{{ ( index $.Site.Data.translations $.Site.Params.locale ).#cursor }}
Whenever I type "trn", I get the above, what's left is to paste the key from translations file and I get the value in correct language.
Hack part. The blog posts will work fine on /lt/, but not static pages (landing pages). I use this instruction.
Basically, every static page, for example content/lt/duk.md will have slug set:
slug: "lt/duk"
But this slug will result in double URL path, for example lt/lt/duk.
I restore this using my npm scripts task using rsync and manual command to delete redundant folder:
"restorefolders": "rsync -a public/lt/lt/ public/lt/ && rm -rf public/lt/lt/",

App Engine Instance ID

Is it possible to get info on what instance you're running on? I want to output just a simple identifier for which instance the code is currently running on for logging purposes.
Since there is no language tag, and seeing your profile history, I assume you are using GAE/J?
In that case, the instance ID information is embedded in one of the environment attributes that you could get via ApiProxy.getCurrentEnvironment() method. You could then extract the instance id from the resulting map using key BackendService.INSTANCE_ID_ENV_ATTRIBUTE.
Even though the key is stored in BackendService, this approach will also work for frontend instances. So in summary, the following code would fetch the instance ID for you:
String tInstanceId = ApiProxy.getCurrentEnvironment()
.getAttributes()
.get( BackendService.INSTANCE_ID_ENV_ATTRIBUTE )
.toString();
Please keep in mind that this approach is quite undocumented by Google, and might subject to change without warning in the future. But since your use case is only for logging, I think it would be sufficient for now.
With the advent of Modules, you can get the current instance id in a more elegant way:
ModulesServiceFactory.getModulesService().getCurrentInstanceId()
Even better, you should wrap the call in a try catch so that it will work correctly locally too.
Import this
import com.google.appengine.api.modules.ModulesException;
import com.google.appengine.api.modules.ModulesServiceFactory;
Then your method can run this
String instanceId = "unknown";
try{
instanceId = ModulesServiceFactory.getModulesService().getCurrentInstanceId();
} catch (ModulesException e){
instanceId = e.getMessage();
}
Without the try catch, you will get some nasty errors when running locally.
I have found this super useful for debugging when using endpoints mixed with pub-sub and other bits to try to determine why some things work differently and to determine if it is related to new instances.
Not sure about before, but today in 2021 the system environment variable GAE_INSTANCE appears to contain the instance id:
instanceId = System.getenv("GAE_INSTANCE")

How to show stacktrace in django-debug-toolbar

How can I force ddt to show me stacktrace? I can only see parts of templates in which queries are executed. But there are no views which generates queries. I set
'ENABLE_STACKTRACES' : True
in settings but this does not help me. I have version 0.9.4.
Allow myself to quote... myself:
You can patch your 0.9.4 install by changing debug_toolbar/panels/sql.py:197 to read
params = map(escape, os.path.split(frame[0]) + frame[1:])
(and import os.path somewhere above).
It looks like this issue was fixed in 12fdf7e (render_stacktrace).

IceCast Server Fall back file

How do I set up a fall-back file for an IceCast server?
If you happen to be using a very useful toolset named liquidsoap with icecast2 then you ought to be thrilled with the follow example, which will play a directory of sound files, or if there is a live stream broadcast then it will fadeout the playlist, play a "jingle" sound file, then fadeup the live stream. Aside from the silly urls this was pulled from a working environment.
Installing liquidsoap was as painless as apt-get install. If you want to use mp3 then apt-get install lame and then switch to output.icecast.lame(). Create a file with a .liq extension (example.liq), then chmod +x example.liq and you're off to the ./races
#!/usr/bin/liquidsoap
# use the -d flag for daemon mode
set("log.file",false)
set("log.stdout",true)
set("log.level",3)
set("harbor.icy",true)
default = single("say:How are you gentlemen!!
all your base are belong to us.
You are on the way to destruction.
What you say!!
You have no chance to survive make your time!
HA! HA! HA! HA! HA!")
jingles = playlist("/home/edward/micronemez-jinglez")
audio = playlist("/home/edward/micronemez-ogg")
#liveset = mksafe(input.http("http://audio.micronemez.com"))
liveset = strip_blank(input.http("http://f-dt.com"))
liveset = rewrite_metadata([("artist", "FUTURE__DEATH__TOLL"),("title", "LIVE FROM YELLOW_HOUSE")], liveset)
radio = fallback(track_sensitive=false,
[skip_blank(liveset), audio, default])
radio = random(weights=[1,5],[ jingles, radio ])
output.icecast.vorbis(
host="futuredeathtoll.com",port=8000,password="hackme",
genre="Easy Listening",url="http://f-dt.com",
description="pirate radio",mount="micronemez-radio.ogg",
name="FUTURE__DEATH__TOLL ((YELLOW_HOUSE))",radio)
some very useful links:
http://savonet.sourceforge.net/doc-svn/cookbook.html
http://oshyn.com/_blog/General/post/Audio_and_Video_Streaming_with_Liquidsoap_and_Icecast/
http://wiki.sourcefabric.org/display/LS/WikiStart
From the doc:
fallback-mount>/example2.ogg</fallback-mount>
<fallback-override>1</fallback-override>
<fallback-when-full>1</fallback-when-full>`
Please see icecast2_config_file for more explanation scroll to the fallback-mount description.

Resources