I hereby claim:
- I am brunoripa on github.
- I am brunoripa (https://keybase.io/brunoripa) on keybase.
- I have a public key ASA-fXSrhM7SZhIvYpDuvpZ-M0VgTZPnDVCERHWCcs9rxQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
steps: | |
- name: 'gcr.io/cloud-builders/docker' | |
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/runexample', '.' ] | |
- name: 'gcr.io/cloud-builders/docker' | |
args: [ 'push', 'gcr.io/$PROJECT_ID/runexample'] | |
- name: gcr.io/cloud-builders/gcloud | |
env: | |
- 'HOSTNAME=${_HOSTNAME}' | |
- 'PORT=${_PORT}' | |
- 'PAYMENT_KEY=${_PAYMENT_KEY}' |
defmodule ElixirTestOneWeb.KeysController do | |
use ElixirTestOneWeb, :controller | |
@spec index(Plug.Conn.t(), any()) :: Plug.Conn.t() | |
def index(conn, _opts) do | |
conn | |
|> json(%{ | |
keys: | |
Application.get_env(:app, :config_keys) |
to_be_joined = ( | |
{ | |
'timings': timings, | |
'users': users | |
} | | |
apache_beam.CoGroupByKey() | | |
apache_beam.ParDo(WriteToCSV()) | | |
WriteToText(output_filename) | |
) |
class CollectTimings(apache_beam.DoFn): | |
def process(self, element): | |
""" | |
Returns a list of tuples containing country and duration | |
""" | |
result = [ | |
(element['country'], element['duration']) | |
] |
timings = ( | |
rows | | |
apache_beam.ParDo(CollectTimings()) | | |
"Grouping timings" >> apache_beam.GroupByKey() | | |
"Calculating average" >> apache_beam.CombineValues( | |
apache_beam.combiners.MeanCombineFn() | |
) | |
) | |
users = ( |
{ | |
"Spain (ES)": [2.2, 2.9], | |
"United kingdom (UK)": [4.2] | |
} |
with apache_beam.Pipeline(options=options) as p: | |
rows = ( | |
p | | |
ReadFromText(input_filename) | | |
apache_beam.ParDo(Split()) | |
) |
class Split(apache_beam.DoFn): | |
def process(self, element): | |
country, duration, user = element.split(",") | |
return [{ | |
'country': country, | |
'duration': float(duration), | |
'user': user | |
}] |
with apache_beam.Pipeline(options=options) as p: | |
rows = ( | |
p | | |
ReadFromText("input.txt") | | |
apache_beam.ParDo(Split()) | |
) | |
timings = ( | |
rows | |