Skip to content

Instantly share code, notes, and snippets.

View mehd-io's full-sized avatar
🎥
Coding as much as recording

Mehdi OUAZZA mehd-io

🎥
Coding as much as recording
View GitHub Profile
@mehd-io
mehd-io / medium-devcontainer-devcontainer.json
Created January 8, 2021 09:45
medium-devcontainer-devcontainer.json
{
"name": "Python 3.8",
"build": {
"dockerfile": "../docker/dev.Dockerfile",
"context": "..",
// Update 'VARIANT' to pick a Python version. Rebuild the container
// if it already exists to update. Available variants: 3, 3.6, 3.7, 3.8
"args": { "VARIANT": "3.8" }
},
# List hadoop conf while running a pyspark job
hadoopConf = {}
iterator = sc._jsc.hadoopConfiguration().iterator()
while iterator.hasNext():
prop = iterator.next()
hadoopConf[prop.getKey()] = prop.getValue()
for item in sorted(hadoopConf.items()):
@mehd-io
mehd-io / slack_failed_task.md
Last active February 25, 2019 10:28
Airflow - proper Slack notifications

Define the custom function in the dag :

sc = SlackClient(my_slack_token)

def slack_failed_task(contextDictionary, **kwargs):
        base_url = mybasedUrl
        task_instance = contextDictionary.get('task_instance')
        log_url = '{task_instance.log_url}'.format(**locals())
 failed_alert = sc.api_call('chat.postMessage',