Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
Set variables in environment variable in Airflow

I am creating an Airflow DAG for my pythin job. This jobs create json files in s3 bucket with current date. I am planning to pass the date as environment variable. is it possible to do so? what i am trying is below

recommendations = KubernetesPodOperator(
    namespace='data',
    image = "quay.io/comp/data-rp-recommender:0.1.1",
    name = "data-rp-recommender-run",
    task_id = "data-rp-recommender-task",
    dag = dag,
    get_logs = True,
    in_cluster = True,
    is_delete_operator_pod = False,
    volumes = [
        Volume(
            name = 'etcctek',

        )
    ],
    volume_mounts = [
        VolumeMount(
            name = 'etcctek',
            mount_path = '/opt/docker/etc',
            sub_path = None,
            read_only = True
        )
    ],
    env_vars = {
    'DATE' :
    'USER_PRECEDING_STATS_S3' : 's3a://ml/rp-recommendations/userPreceedingStats/int/DATE/json'
    'NUGGET_CATEGORICALS_S3' : 's3a://ml/rp-recommendations/nuggetCategorials/int/DATE/json'
    'PREREQUISITE_STATS_S3' : 's3a://ml/rp-recommendations/prerequisiteStats/int/DATE/json'
    'USER_CURRENT_STATS_S3' : 's3a://ml/rp-recommendations/userCurrentStats/int/DATE/json'
    },
 
    resources = {
        'request_memory': '2048M',
        'request_cpu': '1.5'
    }
)

In the above example i want to set env_vars for DATE as current date and then use that current date in other variables below. It's my first time in airflow and needs some help

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Assuming you want to write task execution start time:

var = '{{ ti.start_date }}'

More details on task instance model here

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda