问:
get posts query wordpress
i try to get posts via query wordpress
i need to fetch the posts thats's in spacfic taxonamy

تصميم تطبيقات

```<code><?php
            get_query_var('taxonomy');
            $taxonomy = 'eposd_category';
            $terms = get_terms($taxonomy); // Get all terms of a taxonomy

            if ( $terms && !is_wp_error( $terms ) ) :
            ?>
            <?php foreach ( $terms as $term ) { ?>
            <div class="col-sm-3">
                <div class="item">
                    <div class="load">
                        <?php echo z_taxonomy_image($lug term->term_s); ?>
                        <div class="load-icon text-center">
                            <a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"> <i class="fa fa-play"></i></a>
                        </div>
                    </div>
                    <div class="item-content">
                        <h2><?php echo $term->name; ?></h2>
                    </div>
                </div>
            </div>
        <?php } ?>
<?php endif;?>

</code>```

تصميم العاب

Title: get posts query wordpress

Body:
i try to get posts via query wordpress
i need to fetch the posts thats's in spacfic taxonamy

تصميم تطبيقات

<?php
            get_query_var('taxonomy');
            $taxonomy = 'eposd_category';
            $terms = get_terms($taxonomy); // Get all terms of a taxonomy

            if ( $terms && !is_wp_error( $terms ) ) :
            ?>
            <?php foreach ( $terms as $term ) { ?>

                        <?php echo z_taxonomy_image($lug term->term_s); ?>

                            <a href="<?php echo get_term_link($term->slug, $taxonomy); ?>">

<?php echo $term->name; ?>

        <?php } ?>
<?php endif;?>

تصميم العاب


来源: stackexchange

问:
How to define same dependency for two different environments in gradle
On gradle file, I have two same dependencies from this first will work for actual code and the second for test, it is look redundant,

```<code>implementation("com.fasterxml.jackson.core:jackson-databind:2.12.7.1")
</code>```
```<code>testImplementation("com.fasterxml.jackson.core:jackson-databind:2.12.7.1")
</code>```

So is it any other way to define these dependencies in a simple way may be in one line or something

ContentLicense: CC BY-SA 4.0

Body:
On gradle file, I have two same dependencies from this first will work for actual code and the second for test, it is look redundant,

implementation("com.fasterxml.jackson.core:jackson-databind:2.12.7.1")

testImplementation("com.fasterxml.jackson.core:jackson-databind:2.12.7.1")

So is it any other way to define these dependencies in a simple way may be in one line or something


问:
Unable to build android app in github actions, No matching configuration of project services was found
I am trying to build the app in github actions but I am facing an error which doesn't happen to me on my device when I run gradlew assembleDebug --stacktrace

```<code>Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :services.
     Required by:
         project :app
      > No matching configuration of project :services was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
</code>```

The project is a multimodule app

Here is the services gradle file

```<code>import dependencies.Apollo
import dependencies.Dependencies
import dependencies.RoomDependencies
import dependencies.Versions

plugins {
    id("com.android.library")
    id("kotlin-android")
    id("com.apollographql.apollo3")
    id("org.jlleitschuh.gradle.ktlint")
    id 'kotlin-kapt'
}
apollo {
    useVersion2Compat()
    generateKotlinModels.set(true)
    srcDir("src/main/graphql")
}

android {
    compileSdkVersion Versions.compilesdk
    buildToolsVersion Versions.buildTools
    kotlinOptions {
        jvmTarget = '11'
        freeCompilerArgs = ["-Xallow-result-return-type"]
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    buildTypes {
        release {
              }
        debug {

        }
    }
}

repositories {
    mavenCentral()
}
java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
    kapt("com.apollographql.apollo3:apollo-runtime:3.2.1")
    implementation(Apollo.APOLLO_CACHE)
    implementation(Apollo.APOLLO_SQL)
    implementation project( ":linguisticdomain")
    // retrofit
    implementation(Dependencies.retrofit)
    implementation("com.google.android.gms:play-services-location:18.0.0")

    // room
    implementation(RoomDependencies.room_ktx)
    implementation(RoomDependencies.room_runtime)
    kapt(RoomDependencies.room_compiler)
    implementation(RoomDependencies.ROOM_TEST)
}
</code>```

Here is the app gradle file

```<code>import dependencies.*
import dependencies.dependencies.SupportDependencies
import dependencies.dependencies.TestDependencies

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id "androidx.navigation.safeargs"
    id 'dagger.hilt.android.plugin'
    id 'com.google.gms.google-services'  // Google Services plugin
    id 'com.google.firebase.crashlytics'
    id 'org.jlleitschuh.gradle.ktlint'
}

android {
    compileSdkVersion Versions.compilesdk
    buildToolsVersion Versions.buildTools

    buildFeatures {
        compose true
        dataBinding = true
        viewBinding = true

    }

    kotlinOptions {
        jvmTarget = '11'
        freeCompilerArgs = ["-Xallow-result-return-type"]
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    defaultConfig {
        applicationId Application.id
        minSdkVersion Versions.minsdk
        targetSdkVersion Versions.targetsdk
        versionCode Application.version_code
        versionName "1.0.2"

        testInstrumentationRunner AndroidTestDependencies.instrumentation_runner

        // ...
        // Set the properties within `local.properties` into a `Properties` class so that values
        // within `local.properties` (e.g. Maps API key) are accessible in this file.
        Properties properties = new Properties()
        if (rootProject.file("local.properties").exists()) {
            properties.load(rootProject.file("local.properties").newDataInputStream())
        }

        // Inject the Maps API key into the manifest
        manifestPlaceholders = [mapsApiKey: properties.getProperty("MAPS_API_KEY", "")]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        }
        debug {
            manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        }
    }

    composeOptions {
        kotlinCompilerVersion Versions.kotlin
        kotlinCompilerExtensionVersion Compose.version
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project( ":linguisticdomain")
    implementation project( ":services")

    // Kotlin
    implementation Dependencies.kotlin_standard_library
    implementation Dependencies.ktx
    //implementation Dependencies.kotlin_extensions

    //support
    implementation SupportDependencies.appcompat
    implementation SupportDependencies.constraintlayout
    implementation SupportDependencies.material_design
    implementation SupportDependencies.legacy_support

    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'

    //test
    testImplementation TestDependencies.junit4
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    //navigation
    implementation Dependencies.navigation_fragment
    implementation Dependencies.navigation_ui

    //ktx
    implementation Dependencies.fragment_ktx
    //apollo
    implementation("com.apollographql.apollo3:apollo-runtime:3.2.1")
    implementation(Apollo.APOLLO_CACHE)
    implementation(Apollo.APOLLO_SQL)

    compileOnly "org.jetbrains:annotations:16.0.1"

    //Build interactive settings screens without needing to interact with device storage or manage the UI.
    implementation Dependencies.android_preferences

    testCompileOnly "org.jetbrains:annotations:16.0.1"

    //debugging
    implementation Dependencies.timber
    //view_pager2
    implementation Dependencies.view_pager2
    // retrofit
    implementation Dependencies.retrofit
    implementation Dependencies.converter_moshi

    implementation "com.squareup.moshi:moshi:1.9.2"
    implementation "com.squareup.moshi:moshi-kotlin:1.9.2"

    implementation "com.squareup.retrofit2:converter-scalars:2.3.0"
    implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'

    implementation 'com.facebook.android:facebook-android-sdk:5.15.3'

    implementation Dependencies.kotlin_coroutines_android
    implementation 'com.facebook.android:facebook-login:5.15.3'

    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'com.github.bumptech.glide:glide:4.12.0'

    implementation Compose.compose_ui
    implementation Compose.compose_tooling
    implementation Compose.compose_foundation
    implementation Compose.compose_material
    implementation Compose.compose_material_icons
    implementation Compose.compose_material_icons_ext
    implementation Compose.compose_activity
    implementation Compose.compose_viewModel
    implementation Compose.compose_livedata
    implementation Compose.constraint_layout
    implementation Compose.compose_run_time
    implementation "androidx.navigation:navigation-compose:2.6.0-alpha03"
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
    implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'

    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'

    implementation 'com.sagar:coroutinespermission:2.0.3'

    // UI Tests
    //   androidTestImplementation 'androidx.ui:ui-test:1.0.0-alpha05'
    androidTestImplementation TestDependencies.arch_core_testing

    implementation "com.google.dagger:hilt-android:2.42"
    kapt "com.google.dagger:hilt-android-compiler:2.42"

    implementation 'androidx.hilt:hilt-work:1.0.0'
    //this gets warning https://stackoverflow.com/questions/49602410/when-should-we-use-android-arch-lifecyclecompiler-or-android-arch-lifecycleco
//    kapt "androidx.lifecycle:lifecycle-compiler:2.2.0"
    implementation Dependencies.work_manager
    implementation Dependencies.lottie_compose
    implementation Dependencies.lottie
    implementation Accompanist.insets
    implementation Accompanist.navigation_animation
    implementation Accompanist.coil

    implementation GoogleMaps.maps
    implementation GoogleMaps.mapsKtx
    implementation "com.github.PhilJay:MPAndroidChart:v3.1.0-alpha"
    implementation "io.github.vanpra.compose-material-dialogs:datetime:0.4.0"

    //firebase
    implementation platform('com.google.firebase:firebase-bom:28.1.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation("com.google.firebase:firebase-iid")
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
    implementation 'com.google.firebase:firebase-core:20.0.2'

    //pusher beams
    implementation 'com.pusher:push-notifications-android:1.6.2'

    // Activity Compose
    implementation "androidx.activity:activity-compose:1.5.1"

    // CameraX
    implementation "androidx.camera:camera-camera2:1.0.2"
    implementation "androidx.camera:camera-lifecycle:1.0.2"
    implementation "androidx.camera:camera-view:1.0.0-alpha31"

    // qrcode
    implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
    implementation 'com.google.zxing:core:3.3.3'
    implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.3'

}
kapt {
    correctErrorTypes true
    generateStubs = true

}
</code>```

The github action code

```<code>name: Distribute to app distribution

on:
  pull_request:

jobs:
  distribute:
    runs-on: ubuntu-latest
    container: alvrme/alpine-android:android-33-jdk11
    steps:
      - uses: actions/checkout@v2

      - name: Cache Gradle
        uses: actions/cache@v1
        with:
          path: ~/.gradle/caches/
          key: cache-clean-gradle-${{ matrix.os }}-${{ matrix.jdk }}

      - name: Cache Gradle Wrapper
        uses: actions/cache@v1
        with:
          path: ~/.gradle/wrapper/
          key: cache-clean-wrapper-${{ matrix.os }}-${{ matrix.jdk }}

      - name: Grant Permission to Execute
        run: chmod +x gradlew

      - name: Distribute app with  App Distribution
        run: |
          extras fastlane
          fastlane android increment_release_name
          fastlane android distribute
</code>```

And that's the complete stack trace

Body:
I am trying to build the app in github actions but I am facing an error which doesn't happen to me on my device when I run gradlew assembleDebug --stacktrace

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :services.
     Required by:
         project :app
      > No matching configuration of project :services was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

The project is a multimodule app

Here is the services gradle file

import dependencies.Apollo
import dependencies.Dependencies
import dependencies.RoomDependencies
import dependencies.Versions

plugins {
    id("com.android.library")
    id("kotlin-android")
    id("com.apollographql.apollo3")
    id("org.jlleitschuh.gradle.ktlint")
    id 'kotlin-kapt'
}
apollo {
    useVersion2Compat()
    generateKotlinModels.set(true)
    srcDir("src/main/graphql")
}

android {
    compileSdkVersion Versions.compilesdk
    buildToolsVersion Versions.buildTools
    kotlinOptions {
        jvmTarget = '11'
        freeCompilerArgs = ["-Xallow-result-return-type"]
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    buildTypes {
        release {
              }
        debug {

        }
    }
}

repositories {
    mavenCentral()
}
java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
    kapt("com.apollographql.apollo3:apollo-runtime:3.2.1")
    implementation(Apollo.APOLLO_CACHE)
    implementation(Apollo.APOLLO_SQL)
    implementation project( ":linguisticdomain")
    // retrofit
    implementation(Dependencies.retrofit)
    implementation("com.google.android.gms:play-services-location:18.0.0")

    // room
    implementation(RoomDependencies.room_ktx)
    implementation(RoomDependencies.room_runtime)
    kapt(RoomDependencies.room_compiler)
    implementation(RoomDependencies.ROOM_TEST)
}

Here is the app gradle file

import dependencies.*
import dependencies.dependencies.SupportDependencies
import dependencies.dependencies.TestDependencies

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id "androidx.navigation.safeargs"
    id 'dagger.hilt.android.plugin'
    id 'com.google.gms.google-services'  // Google Services plugin
    id 'com.google.firebase.crashlytics'
    id 'org.jlleitschuh.gradle.ktlint'
}

android {
    compileSdkVersion Versions.compilesdk
    buildToolsVersion Versions.buildTools

    buildFeatures {
        compose true
        dataBinding = true
        viewBinding = true

    }

    kotlinOptions {
        jvmTarget = '11'
        freeCompilerArgs = ["-Xallow-result-return-type"]
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    defaultConfig {
        applicationId Application.id
        minSdkVersion Versions.minsdk
        targetSdkVersion Versions.targetsdk
        versionCode Application.version_code
        versionName "1.0.2"

        testInstrumentationRunner AndroidTestDependencies.instrumentation_runner

        // ...
        // Set the properties within `local.properties` into a `Properties` class so that values
        // within `local.properties` (e.g. Maps API key) are accessible in this file.
        Properties properties = new Properties()
        if (rootProject.file("local.properties").exists()) {
            properties.load(rootProject.file("local.properties").newDataInputStream())
        }

        // Inject the Maps API key into the manifest
        manifestPlaceholders = [mapsApiKey: properties.getProperty("MAPS_API_KEY", "")]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        }
        debug {
            manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        }
    }

    composeOptions {
        kotlinCompilerVersion Versions.kotlin
        kotlinCompilerExtensionVersion Compose.version
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project( ":linguisticdomain")
    implementation project( ":services")

    // Kotlin
    implementation Dependencies.kotlin_standard_library
    implementation Dependencies.ktx
    //implementation Dependencies.kotlin_extensions

    //support
    implementation SupportDependencies.appcompat
    implementation SupportDependencies.constraintlayout
    implementation SupportDependencies.material_design
    implementation SupportDependencies.legacy_support

    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'

    //test
    testImplementation TestDependencies.junit4
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    //navigation
    implementation Dependencies.navigation_fragment
    implementation Dependencies.navigation_ui

    //ktx
    implementation Dependencies.fragment_ktx
    //apollo
    implementation("com.apollographql.apollo3:apollo-runtime:3.2.1")
    implementation(Apollo.APOLLO_CACHE)
    implementation(Apollo.APOLLO_SQL)

    compileOnly "org.jetbrains:annotations:16.0.1"

    //Build interactive settings screens without needing to interact with device storage or manage the UI.
    implementation Dependencies.android_preferences

    testCompileOnly "org.jetbrains:annotations:16.0.1"

    //debugging
    implementation Dependencies.timber
    //view_pager2
    implementation Dependencies.view_pager2
    // retrofit
    implementation Dependencies.retrofit
    implementation Dependencies.converter_moshi

    implementation "com.squareup.moshi:moshi:1.9.2"
    implementation "com.squareup.moshi:moshi-kotlin:1.9.2"

    implementation "com.squareup.retrofit2:converter-scalars:2.3.0"
    implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'

    implementation 'com.facebook.android:facebook-android-sdk:5.15.3'

    implementation Dependencies.kotlin_coroutines_android
    implementation 'com.facebook.android:facebook-login:5.15.3'

    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'com.github.bumptech.glide:glide:4.12.0'

    implementation Compose.compose_ui
    implementation Compose.compose_tooling
    implementation Compose.compose_foundation
    implementation Compose.compose_material
    implementation Compose.compose_material_icons
    implementation Compose.compose_material_icons_ext
    implementation Compose.compose_activity
    implementation Compose.compose_viewModel
    implementation Compose.compose_livedata
    implementation Compose.constraint_layout
    implementation Compose.compose_run_time
    implementation "androidx.navigation:navigation-compose:2.6.0-alpha03"
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
    implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'

    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'

    implementation 'com.sagar:coroutinespermission:2.0.3'

    // UI Tests
    //   androidTestImplementation 'androidx.ui:ui-test:1.0.0-alpha05'
    androidTestImplementation TestDependencies.arch_core_testing

    implementation "com.google.dagger:hilt-android:2.42"
    kapt "com.google.dagger:hilt-android-compiler:2.42"

    implementation 'androidx.hilt:hilt-work:1.0.0'
    //this gets warning https://stackoverflow.com/questions/49602410/when-should-we-use-android-arch-lifecyclecompiler-or-android-arch-lifecycleco
//    kapt "androidx.lifecycle:lifecycle-compiler:2.2.0"
    implementation Dependencies.work_manager
    implementation Dependencies.lottie_compose
    implementation Dependencies.lottie
    implementation Accompanist.insets
    implementation Accompanist.navigation_animation
    implementation Accompanist.coil

    implementation GoogleMaps.maps
    implementation GoogleMaps.mapsKtx
    implementation "com.github.PhilJay:MPAndroidChart:v3.1.0-alpha"
    implementation "io.github.vanpra.compose-material-dialogs:datetime:0.4.0"

    //firebase
    implementation platform('com.google.firebase:firebase-bom:28.1.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation("com.google.firebase:firebase-iid")
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
    implementation 'com.google.firebase:firebase-core:20.0.2'

    //pusher beams
    implementation 'com.pusher:push-notifications-android:1.6.2'

    // Activity Compose
    implementation "androidx.activity:activity-compose:1.5.1"

    // CameraX
    implementation "androidx.camera:camera-camera2:1.0.2"
    implementation "androidx.camera:camera-lifecycle:1.0.2"
    implementation "androidx.camera:camera-view:1.0.0-alpha31"

    // qrcode
    implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
    implementation 'com.google.zxing:core:3.3.3'
    implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.3'

}
kapt {
    correctErrorTypes true
    generateStubs = true

}

The github action code

name: Distribute to app distribution

on:
  pull_request:

jobs:
  distribute:
    runs-on: ubuntu-latest
    container: alvrme/alpine-android:android-33-jdk11
    steps:
      - uses: actions/checkout@v2

      - name: Cache Gradle
        uses: actions/cache@v1
        with:
          path: ~/.gradle/caches/
          key: cache-clean-gradle-${{ matrix.os }}-${{ matrix.jdk }}

      - name: Cache Gradle Wrapper
        uses: actions/cache@v1
        with:
          path: ~/.gradle/wrapper/
          key: cache-clean-wrapper-${{ matrix.os }}-${{ matrix.jdk }}

      - name: Grant Permission to Execute
        run: chmod +x gradlew

      - name: Distribute app with  App Distribution
        run: |
          extras fastlane
          fastlane android increment_release_name
          fastlane android distribute

And that's the complete stack trace


问:
Airflow task failing intermittently when using SnowflakeHook
I'm using AWS managed Airflow (MWAA) to orchestrate some dags, but some of them are failing in an intermittent way in tasks that use SnowflakeHook provider.

Here is the dag code:

```<code># Standard Library Imports
import logging
from datetime import timedelta, datetime

# 3rd Party Imports
from airflow.models import DAG
from airflow.operators.python_operator import PythonOperator

# Internal Imports
from DagTasksImpl import raw_ingest, preprocess, stage, get_parameter, send_failed_email
from operators.CustomS3ToSnowflakeOperator import CustomS3ToSnowflakeOperator
from operators.PostprocessingOperator import PostprocessingOperator
from airflow.contrib.operators.sns_publish_operator import SnsPublishOperator

LOGGER = logging.getLogger(__name__)

EXECUTION_DATE = '{{ macros.ds_format(macros.ds_add(yesterday_ds, 7), "%Y-%m-%d", "%Y_%m_%d") }}'
SOURCE_BUCKET = "{{params.get_parameter('/durable/buckets/ce_signal_channel')}}"
RAW_INGEST_BUCKET = "{{params.get_parameter('/durable/buckets/raw')}}"
PROCESSED_BUCKET = "{{params.get_parameter('/durable/buckets/processed')}}"
STAGED_BUCKET = "{{params.get_parameter('/durable/buckets/staged')}}"

DAY_SYM_BRAND_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/day_sym_brand_channel_emax_{EXECUTION_DATE}.csv"
DAY_SYM_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/day_sym_channel_emax_{EXECUTION_DATE}.csv"
PERIOD_SYM_BRAND_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/period_sym_brand_channel_emax_{EXECUTION_DATE}.csv"
PERIOD_SYM_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/period_sym_channel_emax_{EXECUTION_DATE}.csv"

SIGNAL_CHANNEL_FILES = [DAY_SYM_BRAND_CHANNEL_EMAX_KEY, DAY_SYM_CHANNEL_EMAX_KEY,
                        PERIOD_SYM_BRAND_CHANNEL_EMAX_KEY, PERIOD_SYM_CHANNEL_EMAX_KEY]

IS_GZIP = False

DEFAULT_ARGS = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2021, 5, 16),
    'on_failure_callback': send_failed_email,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

def raw_ingest_task_callable(source_bucket, target_bucket, keys, **kwargs):
    for key in keys:
        LOGGER.info(f"Preparing to ingest data from source: {source_bucket}/{key} to target: {target_bucket}/{key}")
        raw_ingest(source_bucket, target_bucket, key, IS_GZIP)

TASK_RAW_INGEST = PythonOperator(
    task_id="raw_ingest",
    provide_context=True,
    python_callable=raw_ingest_task_callable,
    op_kwargs={"source_bucket": SOURCE_BUCKET, "target_bucket": RAW_INGEST_BUCKET, "keys": SIGNAL_CHANNEL_FILES},
    params={"get_parameter": get_parameter},
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
)

def preprocess_task_callable(source_bucket, target_bucket, keys, **kwargs):
    for key in keys:
        LOGGER.info(f"Preparing to ingest data from source: {source_bucket}/{key} to target: {target_bucket}/{key}")
        preprocess(source_bucket, target_bucket, key, IS_GZIP)

TASK_PREPROCESS = PythonOperator(
    task_id="preprocess",
    provide_context=True,
    python_callable=preprocess_task_callable,
    op_kwargs={"source_bucket": RAW_INGEST_BUCKET, "target_bucket": PROCESSED_BUCKET, "keys": SIGNAL_CHANNEL_FILES},
    params={"get_parameter": get_parameter},
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
)

def stage_task_callable(source_bucket, target_bucket, keys, **kwargs):
    for key in keys:
        LOGGER.info(f"Preparing to ingest data from source: {source_bucket}/{key} to target: {target_bucket}/{key}")
        stage(source_bucket, target_bucket, key, IS_GZIP)

TASK_STAGE = PythonOperator(
    task_id="stage",
    provide_context=True,
    python_callable=stage_task_callable,
    op_kwargs={"source_bucket": PROCESSED_BUCKET, "target_bucket": STAGED_BUCKET, "keys": SIGNAL_CHANNEL_FILES},
    params={"get_parameter": get_parameter},
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
)

TASK_COPY_INTO_TABLE_DAY_SYM_BRAND_CHANNEL_EMAX = CustomS3ToSnowflakeOperator(
    task_id='copy_into_table_day_sym_brand_channel_emax',
    s3_keys=[DAY_SYM_BRAND_CHANNEL_EMAX_KEY],
    table="day_sym_brand_channel_emax",
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
    pool="snowflake_pool"
)

TASK_COPY_INTO_TABLE_PERIOD_SYM_CHANNEL_EMAX = CustomS3ToSnowflakeOperator(
    task_id='copy_into_table_period_sym_channel_emax',
    s3_keys=[PERIOD_SYM_CHANNEL_EMAX_KEY],
    table="period_sym_channel_emax",
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
    pool="snowflake_pool"
)

SEND_EMAIL = SnsPublishOperator(
    task_id='send_email',
    target_arn=get_parameter("/sns/mwaa"),
    subject='Transact Weekly Signal Channel Notification',
    message=f"Transact Weekly Signal Channel workflow has been successfully completed for the CE Data uploaded on {EXECUTION_DATE}",
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG
)

TASK_RAW_INGEST >> TASK_PREPROCESS >> TASK_STAGE >>
TASK_COPY_INTO_TABLE_DAY_SYM_BRAND_CHANNEL_EMAX >> TASK_POSTPROCESS_SYM_BRAND_CHANNEL_EMAX >> SEND_EMAIL

</code>```

CustomS3ToSnowflakeOperator

```<code>
from typing import Any, Optional

from airflow.models import BaseOperator
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
from airflow.utils.decorators import apply_defaults
import boto3

class CustomS3ToSnowflakeOperator(BaseOperator):
    template_fields = ('s3_keys',)
    sum_column = "spend_amount_90D"

    @apply_defaults
    def __init__(
            self,
            *,
            s3_keys,
            table: str,
            stage: Any = 'consumer_edge_stage',
            file_format: str = "(type = csv field_delimiter = ',' skip_header = 1 field_optionally_enclosed_by = '\"')",
            schema: str = 'PUBLIC',
            gzip: Optional[bool] = False,
            autocommit: bool = True,
            snowflake_conn_id: str = 'snowflake_connection_id',
            **kwargs,
    ) -> None:
        super().__init__(**kwargs)
        self.s3_keys = s3_keys
        self.table = table
        self.stage = stage
        self.file_format = file_format
        self.schema = schema
        self.gzip = gzip
        self.autocommit = autocommit
        self.snowflake_conn_id = snowflake_conn_id
        self.temp_table = f"{table}_tmp"

    def execute(self, context: Any) -> None:
        snowflake_hook = SnowflakeHook(snowflake_conn_id=self.snowflake_conn_id)
        self.wipe_table(snowflake_hook)
        if "day" in self.table:
            self.create_temp_table(snowflake_hook)
            self.copy_into_table(self.get_files(), snowflake_hook, self.temp_table)
        else:
            self.copy_into_table(self.get_files(), snowflake_hook, self.table)

    def wipe_table(self, snowflake_hook):
        wipe_query = f"truncate table if exists {self.table}"
        self.log.info('Wiping table...')
        snowflake_hook.run(wipe_query, self.autocommit)
        self.log.info('Truncate command complete...')

    def create_temp_table(self, snowflake_hook):
        create_temp_table_query = f"create or replace table {self.temp_table} clone {self.table}"
        self.log.info('Creating table...')
        snowflake_hook.run(create_temp_table_query, self.autocommit)
        self.log.info('Create table command complete...')

        drop_column_query = f"alter table {self.temp_table} drop column {self.sum_column}"
        snowflake_hook.run(drop_column_query, self.autocommit)

    def get_files(self):
        if self.gzip:
            bucket_and_key = str(self.s3_keys)
            bucket_and_key = bucket_and_key.replace('[', '')
            bucket_and_key = bucket_and_key.replace(']', '')
            bucket_and_key = bucket_and_key.replace("'", '')
            s3 = boto3.resource('s3')
            path_parts = bucket_and_key.replace("s3://", "").split("/")
            bucket = path_parts.pop(0)
            key = "/".join(path_parts)
            source_bucket = s3.Bucket(bucket)
            files_list = []
            for obj in source_bucket.objects.filter(Prefix=key):
                files_list.append(obj.key)
            files = str(files_list)
        else:
            files = str(self.s3_keys)
        files = files.replace('[', '(')
        files = files.replace(']', ')')
        return files

    def copy_into_table(self, files, snowflake_hook, table):
        base_sql = """
                            FROM @{stage}/
                            files={files}
                            file_format={file_format}
                        """.format(
            stage=self.stage, files=files, file_format=self.file_format
        )

        copy_query = """
                    COPY INTO {schema}.{table} {base_sql}
                """.format(
            schema=self.schema, table=table, base_sql=base_sql
        )
        self.log.info('Executing COPY command...')
        snowflake_hook.run(copy_query, self.autocommit)
        self.log.info("COPY command completed")

</code>```

Here are the logs from the failing tasks:

```<code>
*** Reading remote log from Cloudwatch log_group: airflow-ConsumerEdgeAirflowEnvironment-Task log_stream: ce_transact_weekly_signal_channel_2/copy_into_table_day_sym_brand_channel_emax/2022-12-05T14_00_00+00_00/1.log.
[2022-12-12 14:02:13,653] {{taskinstance.py:670}} INFO - Dependencies all met for <TaskInstance: ce_transact_weekly_signal_channel_2.copy_into_table_day_sym_brand_channel_emax 2022-12-05T14:00:00+00:00 [queued]>
[2022-12-12 14:02:13,887] {{taskinstance.py:670}} INFO - Dependencies all met for <TaskInstance: ce_transact_weekly_signal_channel_2.copy_into_table_day_sym_brand_channel_emax 2022-12-05T14:00:00+00:00 [queued]>
[2022-12-12 14:02:13,929] {{taskinstance.py:880}} INFO -
--------------------------------------------------------------------------------
[2022-12-12 14:02:13,946] {{taskinstance.py:881}} INFO - Starting attempt 1 of 2
[2022-12-12 14:02:13,967] {{taskinstance.py:882}} INFO -
--------------------------------------------------------------------------------
[2022-12-12 14:02:14,052] {{taskinstance.py:901}} INFO - Executing <Task(CustomS3ToSnowflakeOperator): copy_into_table_day_sym_brand_channel_emax> on 2022-12-05T14:00:00+00:00
[2022-12-12 14:02:14,088] {{standard_task_runner.py:54}} INFO - Started process 12690 to run task
[2022-12-12 14:02:14,165] {{standard_task_runner.py:77}} INFO - Running: ['airflow', 'run', 'ce_transact_weekly_signal_channel_2', 'copy_into_table_day_sym_brand_channel_emax', '2022-12-05T14:00:00+00:00', '--job_id', '11386', '--pool', 'default_pool', '--raw', '-sd', 'DAGS_FOLDER/CeTransactWeeklySignalChannel.py', '--cfg_path', '/tmp/tmptw5qhtdm']
[2022-12-12 14:02:14,975] {{standard_task_runner.py:78}} INFO - Job 11386: Subtask copy_into_table_day_sym_brand_channel_emax
[2022-12-12 14:02:15,640] {{logging_mixin.py:112}} INFO - Running %s on host %s <TaskInstance: ce_transact_weekly_signal_channel_2.copy_into_table_day_sym_brand_channel_emax 2022-12-05T14:00:00+00:00 [running]> ip-10-192-21-170.us-east-2.compute.internal
[2022-12-12 14:02:15,943] {{CustomS3ToSnowflakeOperator.py:49}} INFO - Wiping table...
[2022-12-12 14:02:16,037] {{connection.py:280}} INFO - Snowflake Connector for Python Version: 2.8.2, Python Version: 3.7.10, Platform: Linux-4.14.294-220.533.amzn2.x86_64-x86_64-with-glibc2.2.5
[2022-12-12 14:02:16,055] {{connection.py:935}} INFO - This connection is in OCSP Fail Open Mode. TLS Certificates would be checked for validity and revocation status. Any other Certificate Revocation related exceptions or OCSP Responder failures would be disregarded in favor of connectivity.
[2022-12-12 14:02:16,073] {{connection.py:952}} INFO - Setting use_openssl_only mode to False
[2022-12-12 14:02:28,275] {{logging_mixin.py:112}} WARNING - Exception ignored in: <function BaseFileLock.__del__ at 0x7fba82bbf5f0>
[2022-12-12 14:02:28,467] {{logging_mixin.py:112}} WARNING - Traceback (most recent call last):
[2022-12-12 14:02:28,527] {{logging_mixin.py:112}} WARNING -   File "/usr/local/airflow/.local/lib/python3.7/site-packages/filelock/_api.py", line 240, in __del__
[2022-12-12 14:02:28,548] {{logging_mixin.py:112}} WARNING -     self.release(force=True)
[2022-12-12 14:02:28,571] {{logging_mixin.py:112}} WARNING -   File "/usr/local/airflow/.local/lib/python3.7/site-packages/filelock/_api.py", line 201, in release
[2022-12-12 14:02:28,628] {{logging_mixin.py:112}} WARNING -     with self._thread_lock:
[2022-12-12 14:02:28,646] {{logging_mixin.py:112}} WARNING - AttributeError: 'UnixFileLock' object has no attribute '_thread_lock'

</code>```

Does anyone faced some similar error?

Usually after one or two retries of the failed tasks make them succeed. Because of this intermittent intermittent character and the BaseLock mention in the logs I thogth it was related to some concurrency problem. But even eliminating all the concurrency between tasks on the airflow instance (by limiting the pool slots to 1) didn't solved the problem.

Body:
I'm using AWS managed Airflow (MWAA) to orchestrate some dags, but some of them are failing in an intermittent way in tasks that use SnowflakeHook provider.

Here is the dag code:

# Standard Library Imports
import logging
from datetime import timedelta, datetime

# 3rd Party Imports
from airflow.models import DAG
from airflow.operators.python_operator import PythonOperator

# Internal Imports
from DagTasksImpl import raw_ingest, preprocess, stage, get_parameter, send_failed_email
from operators.CustomS3ToSnowflakeOperator import CustomS3ToSnowflakeOperator
from operators.PostprocessingOperator import PostprocessingOperator
from airflow.contrib.operators.sns_publish_operator import SnsPublishOperator

LOGGER = logging.getLogger(__name__)

EXECUTION_DATE = '{{ macros.ds_format(macros.ds_add(yesterday_ds, 7), "%Y-%m-%d", "%Y_%m_%d") }}'
SOURCE_BUCKET = "{{params.get_parameter('/durable/buckets/ce_signal_channel')}}"
RAW_INGEST_BUCKET = "{{params.get_parameter('/durable/buckets/raw')}}"
PROCESSED_BUCKET = "{{params.get_parameter('/durable/buckets/processed')}}"
STAGED_BUCKET = "{{params.get_parameter('/durable/buckets/staged')}}"

DAY_SYM_BRAND_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/day_sym_brand_channel_emax_{EXECUTION_DATE}.csv"
DAY_SYM_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/day_sym_channel_emax_{EXECUTION_DATE}.csv"
PERIOD_SYM_BRAND_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/period_sym_brand_channel_emax_{EXECUTION_DATE}.csv"
PERIOD_SYM_CHANNEL_EMAX_KEY = f"{EXECUTION_DATE}/period_sym_channel_emax_{EXECUTION_DATE}.csv"

SIGNAL_CHANNEL_FILES = [DAY_SYM_BRAND_CHANNEL_EMAX_KEY, DAY_SYM_CHANNEL_EMAX_KEY,
                        PERIOD_SYM_BRAND_CHANNEL_EMAX_KEY, PERIOD_SYM_CHANNEL_EMAX_KEY]

IS_GZIP = False

DEFAULT_ARGS = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2021, 5, 16),
    'on_failure_callback': send_failed_email,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

def raw_ingest_task_callable(source_bucket, target_bucket, keys, **kwargs):
    for key in keys:
        LOGGER.info(f"Preparing to ingest data from source: {source_bucket}/{key} to target: {target_bucket}/{key}")
        raw_ingest(source_bucket, target_bucket, key, IS_GZIP)

TASK_RAW_INGEST = PythonOperator(
    task_id="raw_ingest",
    provide_context=True,
    python_callable=raw_ingest_task_callable,
    op_kwargs={"source_bucket": SOURCE_BUCKET, "target_bucket": RAW_INGEST_BUCKET, "keys": SIGNAL_CHANNEL_FILES},
    params={"get_parameter": get_parameter},
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
)

def preprocess_task_callable(source_bucket, target_bucket, keys, **kwargs):
    for key in keys:
        LOGGER.info(f"Preparing to ingest data from source: {source_bucket}/{key} to target: {target_bucket}/{key}")
        preprocess(source_bucket, target_bucket, key, IS_GZIP)

TASK_PREPROCESS = PythonOperator(
    task_id="preprocess",
    provide_context=True,
    python_callable=preprocess_task_callable,
    op_kwargs={"source_bucket": RAW_INGEST_BUCKET, "target_bucket": PROCESSED_BUCKET, "keys": SIGNAL_CHANNEL_FILES},
    params={"get_parameter": get_parameter},
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
)

def stage_task_callable(source_bucket, target_bucket, keys, **kwargs):
    for key in keys:
        LOGGER.info(f"Preparing to ingest data from source: {source_bucket}/{key} to target: {target_bucket}/{key}")
        stage(source_bucket, target_bucket, key, IS_GZIP)

TASK_STAGE = PythonOperator(
    task_id="stage",
    provide_context=True,
    python_callable=stage_task_callable,
    op_kwargs={"source_bucket": PROCESSED_BUCKET, "target_bucket": STAGED_BUCKET, "keys": SIGNAL_CHANNEL_FILES},
    params={"get_parameter": get_parameter},
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
)

TASK_COPY_INTO_TABLE_DAY_SYM_BRAND_CHANNEL_EMAX = CustomS3ToSnowflakeOperator(
    task_id='copy_into_table_day_sym_brand_channel_emax',
    s3_keys=[DAY_SYM_BRAND_CHANNEL_EMAX_KEY],
    table="day_sym_brand_channel_emax",
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
    pool="snowflake_pool"
)

TASK_COPY_INTO_TABLE_PERIOD_SYM_CHANNEL_EMAX = CustomS3ToSnowflakeOperator(
    task_id='copy_into_table_period_sym_channel_emax',
    s3_keys=[PERIOD_SYM_CHANNEL_EMAX_KEY],
    table="period_sym_channel_emax",
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG,
    pool="snowflake_pool"
)

SEND_EMAIL = SnsPublishOperator(
    task_id='send_email',
    target_arn=get_parameter("/sns/mwaa"),
    subject='Transact Weekly Signal Channel Notification',
    message=f"Transact Weekly Signal Channel workflow has been successfully completed for the CE Data uploaded on {EXECUTION_DATE}",
    dag=CE_TRANSACT_WEEKLY_SIGNAL_CHANNEL_DAG
)

TASK_RAW_INGEST >> TASK_PREPROCESS >> TASK_STAGE >>
TASK_COPY_INTO_TABLE_DAY_SYM_BRAND_CHANNEL_EMAX >> TASK_POSTPROCESS_SYM_BRAND_CHANNEL_EMAX >> SEND_EMAIL

CustomS3ToSnowflakeOperator

from typing import Any, Optional

from airflow.models import BaseOperator
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
from airflow.utils.decorators import apply_defaults
import boto3

class CustomS3ToSnowflakeOperator(BaseOperator):
    template_fields = ('s3_keys',)
    sum_column = "spend_amount_90D"

    @apply_defaults
    def __init__(
            self,
            *,
            s3_keys,
            table: str,
            stage: Any = 'consumer_edge_stage',
            file_format: str = "(type = csv field_delimiter = ',' skip_header = 1 field_optionally_enclosed_by = '\"')",
            schema: str = 'PUBLIC',
            gzip: Optional[bool] = False,
            autocommit: bool = True,
            snowflake_conn_id: str = 'snowflake_connection_id',
            **kwargs,
    ) -> None:
        super().__init__(**kwargs)
        self.s3_keys = s3_keys
        self.table = table
        self.stage = stage
        self.file_format = file_format
        self.schema = schema
        self.gzip = gzip
        self.autocommit = autocommit
        self.snowflake_conn_id = snowflake_conn_id
        self.temp_table = f"{table}_tmp"

    def execute(self, context: Any) -> None:
        snowflake_hook = SnowflakeHook(snowflake_conn_id=self.snowflake_conn_id)
        self.wipe_table(snowflake_hook)
        if "day" in self.table:
            self.create_temp_table(snowflake_hook)
            self.copy_into_table(self.get_files(), snowflake_hook, self.temp_table)
        else:
            self.copy_into_table(self.get_files(), snowflake_hook, self.table)

    def wipe_table(self, snowflake_hook):
        wipe_query = f"truncate table if exists {self.table}"
        self.log.info('Wiping table...')
        snowflake_hook.run(wipe_query, self.autocommit)
        self.log.info('Truncate command complete...')

    def create_temp_table(self, snowflake_hook):
        create_temp_table_query = f"create or replace table {self.temp_table} clone {self.table}"
        self.log.info('Creating table...')
        snowflake_hook.run(create_temp_table_query, self.autocommit)
        self.log.info('Create table command complete...')

        drop_column_query = f"alter table {self.temp_table} drop column {self.sum_column}"
        snowflake_hook.run(drop_column_query, self.autocommit)

    def get_files(self):
        if self.gzip:
            bucket_and_key = str(self.s3_keys)
            bucket_and_key = bucket_and_key.replace('[', '')
            bucket_and_key = bucket_and_key.replace(']', '')
            bucket_and_key = bucket_and_key.replace("'", '')
            s3 = boto3.resource('s3')
            path_parts = bucket_and_key.replace("s3://", "").split("/")
            bucket = path_parts.pop(0)
            key = "/".join(path_parts)
            source_bucket = s3.Bucket(bucket)
            files_list = []
            for obj in source_bucket.objects.filter(Prefix=key):
                files_list.append(obj.key)
            files = str(files_list)
        else:
            files = str(self.s3_keys)
        files = files.replace('[', '(')
        files = files.replace(']', ')')
        return files

    def copy_into_table(self, files, snowflake_hook, table):
        base_sql = """
                            FROM @{stage}/
                            files={files}
                            file_format={file_format}
                        """.format(
            stage=self.stage, files=files, file_format=self.file_format
        )

        copy_query = """
                    COPY INTO {schema}.{table} {base_sql}
                """.format(
            schema=self.schema, table=table, base_sql=base_sql
        )
        self.log.info('Executing COPY command...')
        snowflake_hook.run(copy_query, self.autocommit)
        self.log.info("COPY command completed")

Here are the logs from the failing tasks:

*** Reading remote log from Cloudwatch log_group: airflow-ConsumerEdgeAirflowEnvironment-Task log_stream: ce_transact_weekly_signal_channel_2/copy_into_table_day_sym_brand_channel_emax/2022-12-05T14_00_00+00_00/1.log.
[2022-12-12 14:02:13,653] {{taskinstance.py:670}} INFO - Dependencies all met for <TaskInstance: ce_transact_weekly_signal_channel_2.copy_into_table_day_sym_brand_channel_emax 2022-12-05T14:00:00+00:00 [queued]>
[2022-12-12 14:02:13,887] {{taskinstance.py:670}} INFO - Dependencies all met for <TaskInstance: ce_transact_weekly_signal_channel_2.copy_into_table_day_sym_brand_channel_emax 2022-12-05T14:00:00+00:00 [queued]>
[2022-12-12 14:02:13,929] {{taskinstance.py:880}} INFO -
--------------------------------------------------------------------------------
[2022-12-12 14:02:13,946] {{taskinstance.py:881}} INFO - Starting attempt 1 of 2
[2022-12-12 14:02:13,967] {{taskinstance.py:882}} INFO -
--------------------------------------------------------------------------------
[2022-12-12 14:02:14,052] {{taskinstance.py:901}} INFO - Executing <Task(CustomS3ToSnowflakeOperator): copy_into_table_day_sym_brand_channel_emax> on 2022-12-05T14:00:00+00:00
[2022-12-12 14:02:14,088] {{standard_task_runner.py:54}} INFO - Started process 12690 to run task
[2022-12-12 14:02:14,165] {{standard_task_runner.py:77}} INFO - Running: ['airflow', 'run', 'ce_transact_weekly_signal_channel_2', 'copy_into_table_day_sym_brand_channel_emax', '2022-12-05T14:00:00+00:00', '--job_id', '11386', '--pool', 'default_pool', '--raw', '-sd', 'DAGS_FOLDER/CeTransactWeeklySignalChannel.py', '--cfg_path', '/tmp/tmptw5qhtdm']
[2022-12-12 14:02:14,975] {{standard_task_runner.py:78}} INFO - Job 11386: Subtask copy_into_table_day_sym_brand_channel_emax
[2022-12-12 14:02:15,640] {{logging_mixin.py:112}} INFO - Running %s on host %s <TaskInstance: ce_transact_weekly_signal_channel_2.copy_into_table_day_sym_brand_channel_emax 2022-12-05T14:00:00+00:00 [running]> ip-10-192-21-170.us-east-2.compute.internal
[2022-12-12 14:02:15,943] {{CustomS3ToSnowflakeOperator.py:49}} INFO - Wiping table...
[2022-12-12 14:02:16,037] {{connection.py:280}} INFO - Snowflake Connector for Python Version: 2.8.2, Python Version: 3.7.10, Platform: Linux-4.14.294-220.533.amzn2.x86_64-x86_64-with-glibc2.2.5
[2022-12-12 14:02:16,055] {{connection.py:935}} INFO - This connection is in OCSP Fail Open Mode. TLS Certificates would be checked for validity and revocation status. Any other Certificate Revocation related exceptions or OCSP Responder failures would be disregarded in favor of connectivity.
[2022-12-12 14:02:16,073] {{connection.py:952}} INFO - Setting use_openssl_only mode to False
[2022-12-12 14:02:28,275] {{logging_mixin.py:112}} WARNING - Exception ignored in: <function BaseFileLock.__del__ at 0x7fba82bbf5f0>
[2022-12-12 14:02:28,467] {{logging_mixin.py:112}} WARNING - Traceback (most recent call last):
[2022-12-12 14:02:28,527] {{logging_mixin.py:112}} WARNING -   File "/usr/local/airflow/.local/lib/python3.7/site-packages/filelock/_api.py", line 240, in __del__
[2022-12-12 14:02:28,548] {{logging_mixin.py:112}} WARNING -     self.release(force=True)
[2022-12-12 14:02:28,571] {{logging_mixin.py:112}} WARNING -   File "/usr/local/airflow/.local/lib/python3.7/site-packages/filelock/_api.py", line 201, in release
[2022-12-12 14:02:28,628] {{logging_mixin.py:112}} WARNING -     with self._thread_lock:
[2022-12-12 14:02:28,646] {{logging_mixin.py:112}} WARNING - AttributeError: 'UnixFileLock' object has no attribute '_thread_lock'

Does anyone faced some similar error?

Usually after one or two retries of the failed tasks make them succeed. Because of this intermittent intermittent character and the BaseLock mention in the logs I thogth it was related to some concurrency problem. But even eliminating all the concurrency between tasks on the airflow instance (by limiting the pool slots to 1) didn't solved the problem.


问:
Has anyone experienced an issue with not being able to create Asana tasks from Slack?
I have connected Asana with Slack and added Asana to the channel. I have the option to create an Asana task from Slack but when I select any of the options from the dropdown, it tells me Sorry, that didn’t work. Try again?

I have connected Asana with Slack and added Asana to the channel. I have the option to create an Asana task from Slack but when I select any of the options from the dropdown, it tells me Sorry, that didn’t work. Try again?


问:
How can I see which cells are being used in AVERAGEIFs function in Excel? Use VBA to take in those True values
I have a bunch of AVERAGEIFS functions used throughout my worksheet and now I want to make a list of all the values that are being averaged using the functions. Only the values that satisfy the formula. I have VBA code that asks the user to choose a cell with the formula in it and I want the code to list out the values that are being averaged. Thank you!

I've tried thinking about this in a few different ways but I'm hoping there's an easier way than maybe using xlookup and then averaging everything so that it's easier to create his list of values.


问:
Duplicate Install of React / React Native
I am running Expo on MacOS. Running the web app (npm run web), I get the Invalid Hook Call Warning. The web app shows only an empty page with the hook call warning in the console. The iOS version works.
From npm ls react I get the following tree:

```<code>├─┬ react-native@0.70.5
│ ├─┬ react-shallow-renderer@16.15.0
│ │ └── react@18.1.0 deduped
│ ├── react@18.1.0 deduped
│ └─┬ use-sync-external-store@1.2.0
│   └── react@18.1.0 deduped
└── react@18.1.0
</code>```

The documentation doesn't provide much guidance beyond checking the tree. I'm not sure what to do next. To my knowledge I never used npm link.

Body:
I am running Expo on MacOS. Running the web app (npm run web), I get the Invalid Hook Call Warning. The web app shows only an empty page with the hook call warning in the console. The iOS version works.
From npm ls react I get the following tree:

├─┬ react-native@0.70.5
│ ├─┬ react-shallow-renderer@16.15.0
│ │ └── react@18.1.0 deduped
│ ├── react@18.1.0 deduped
│ └─┬ use-sync-external-store@1.2.0
│   └── react@18.1.0 deduped
└── react@18.1.0

The documentation doesn't provide much guidance beyond checking the tree. I'm not sure what to do next. To my knowledge I never used npm link.


问:
TP 3.01A: Is there an inbuilt function or way to get the address of a label?
My goal is to get the 16 bit address of a label in Turbo Pascal 3.01A. I want to use that address inside an inline assembler statement. The main problem is to get the memory address of that label.

Declaring a label is done by the reserved word label:

LABEL lab;
```
<p>Getting the 16 bit address of a declared Integer variable is working fine:</p>
<pre class="lang-pascal prettyprint-override"><code>VAR i,j:Integer;
BEGIN
  i:=$2345;
  j:=$6789;
  WriteLn('$',Hex(HI(Addr(i))),Hex(LO(Addr(i))));
  WriteLn('$',Hex(HI(Addr(j))),Hex(LO(Addr(j))));

</code>```

(Hex() is just some function that I wrote that shows the output in hex format.) Output:

$C857
$C855
```
</blockquote>
<p>But when doing the same on a declared label:</p>
<pre class="lang-pascal prettyprint-override"><code>LABEL lab;
BEGIN
  WriteLn('$',Hex(HI(Addr(lab))),Hex(LO(Addr(lab))));
lab:
  exit;
END.
</code>```

the compiler complains:

Error 41: Unknown identifier or syntax error.

I did expect this to happen. I even tried to put lab: over WriteLn, but got the same error.

Is there another way to overcome this problem? It should be natural to expect that there exists a simple solution to this since mixing inline assembly with regular code was a common thing back when this version of Turbo Pascal was released. I'm wondering if one can use a pointer to the label or read the program counter to retrieve the address of the location at runtime, but for a simple thing like that, it seems a little fiddly.

Body:
My goal is to get the 16 bit address of a label in Turbo Pascal 3.01A. I want to use that address inside an inline assembler statement. The main problem is to get the memory address of that label.

Declaring a label is done by the reserved word label:

LABEL lab;

Getting the 16 bit address of a declared Integer variable is working fine:

VAR i,j:Integer;
BEGIN
  i:=$2345;
  j:=$6789;
  WriteLn('$',Hex(HI(Addr(i))),Hex(LO(Addr(i))));
  WriteLn('$',Hex(HI(Addr(j))),Hex(LO(Addr(j))));

(Hex() is just some function that I wrote that shows the output in hex format.) Output:

$C857
$C855

But when doing the same on a declared label:

LABEL lab;
BEGIN
  WriteLn('$',Hex(HI(Addr(lab))),Hex(LO(Addr(lab))));
lab:
  exit;
END.

the compiler complains:

Error 41: Unknown identifier or syntax error.

I did expect this to happen. I even tried to put lab: over WriteLn, but got the same error.

Is there another way to overcome this problem? It should be natural to expect that there exists a simple solution to this since mixing inline assembly with regular code was a common thing back when this version of Turbo Pascal was released. I'm wondering if one can use a pointer to the label or read the program counter to retrieve the address of the location at runtime, but for a simple thing like that, it seems a little fiddly.


问:
CUDNN_STATUS_BAD_PARAM with cudnnGetConvolutionForwardAlgorithm_v7
I tried to write an easy 3d convolution with cudnn but I encountered a vague error msg called after a successful compilation with NVCC: CUDNN_STATUS_BAD_PARAM on the line of cudnnGetConvolutionForwardAlgorithm_v7. I checked the parameters inside this API and seemed Okay. Not know how to debug at this moment and any suggestion is appreciated. Thanks!

BTW, I am using CUDNN 8.4, CUDA 11.x and my operating system is Ubuntu 18.04. (Should not be version compatibility issue)

```<code>#include <cudnn.h>
#include <cuda.h>
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;

#define checkCUDNN(expression)                               \
  {                                                          \
    cudnnStatus_t status = (expression);                     \
    if (status != CUDNN_STATUS_SUCCESS) {                    \
      std::cerr << "Error on line " << __LINE__ << ": "      \
                << cudnnGetErrorString(status) << std::endl; \
      std::exit(EXIT_FAILURE);                               \
    }                                                        \
  }

int main(int argc, char* argv[]){
    int H = atoi(argv[1]);
    int W = atoi(argv[2]);
    int C = atoi(argv[3]);

    int FH = atoi(argv[4]);
    int FW = atoi(argv[5]);
    int K = atoi(argv[6]);

    double* input = new double[K*H*W];
    double* kernel = new double[K*C*FH*FW];

    for(int k=0; k<K; k++){
        for(int c=0; c<C; c++){
            for(int i=0; i<FH; i++){
                for(int j=0; j<FW; j++){
                    kernel[k*FH*FW*C+c*FH*FW+i*FW+j] = (c+k) * (i+j);
                }
            }
        }
    }

    for(int c=0; c<C; c++){
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                input[c*H*W+i*W+j] = c * (i+j);
            }
        }
    }
    double* output = new double[K*H*W];

    cudnnHandle_t cudnn;
    checkCUDNN(cudnnCreate(&cudnn));

    cudnnTensorDescriptor_t input_descriptor;
    checkCUDNN(cudnnCreateTensorDescriptor(&input_descriptor));
    int dimA[3] = {C, H, W};
    int strideA[3] = {1, 1, 1};
    checkCUDNN(cudnnSetTensorNdDescriptor(input_descriptor, CUDNN_DATA_DOUBLE, 3, dimA, strideA));

    cudnnFilterDescriptor_t kernel_descriptor;
    checkCUDNN(cudnnCreateFilterDescriptor(&kernel_descriptor));
    checkCUDNN(cudnnSetFilter4dDescriptor(kernel_descriptor, CUDNN_DATA_DOUBLE, CUDNN_TENSOR_NCHW, K, C, FH, FW));

    cudnnTensorDescriptor_t output_descriptor;
    checkCUDNN(cudnnCreateTensorDescriptor(&output_descriptor));
    int dimA2[3] = {K, W, H};
    int strideA2[3] = {1, 1, 1};
    checkCUDNN(cudnnSetTensorNdDescriptor(output_descriptor, CUDNN_DATA_DOUBLE, 3, dimA2, strideA2));

    cudnnConvolutionDescriptor_t convolution_descriptor;
    checkCUDNN(cudnnCreateConvolutionDescriptor(&convolution_descriptor));
    int padding[3] = {0, 1, 1};
    int strideA3[3] = {1, 1, 1};
    int dilation[3] = {1, 1, 1};
    checkCUDNN(cudnnSetConvolutionNdDescriptor(convolution_descriptor, 3, padding, strideA3, dilation, CUDNN_CROSS_CORRELATION, CUDNN_DATA_DOUBLE));

    cudnnConvolutionFwdAlgoPerf_t convolution_algorithm;
    int perf_count;
    checkCUDNN(cudnnGetConvolutionForwardAlgorithm_v7(cudnn, input_descriptor, kernel_descriptor, convolution_descriptor, output_descriptor, CUDNN_CONVOLUTION_FWD_ALGO_COUNT , &perf_count, &convolution_algorithm));

    size_t workspace_bytes = 0;
    checkCUDNN(cudnnGetConvolutionForwardWorkspaceSize(cudnn,
                                            input_descriptor,
                                            kernel_descriptor,
                                            convolution_descriptor,
                                            output_descriptor,
                                            convolution_algorithm.algo,
                                            &workspace_bytes));

    double* input_device;
    double* kernel_device;
    double* output_device;
    void* d_workspace{nullptr};
    cudaMalloc(&d_workspace, workspace_bytes);

    cudaMalloc((void **)& input_device, C*H*W*sizeof(double));
    cudaMalloc((void **)& kernel_device, K*C*FH*FW*sizeof(double));
    cudaMalloc((void **)& output_device, K*H*W*sizeof(double));

    cudaMemcpy(input_device, input, C*H*W*sizeof(double), cudaMemcpyHostToDevice);
    cudaMemcpy(kernel_device, kernel, K*C*FH*FW*sizeof(double), cudaMemcpyHostToDevice);
    cudaMemcpy(output_device, output, K*H*W*sizeof(double), cudaMemcpyHostToDevice);

    const double alpha = 1, beta = 0;

    struct timespec time_start = {0, 0};
    struct timespec time_end = {0, 0};

    clock_gettime(CLOCK_MONOTONIC, &time_start);

    cudnnConvolutionForward(cudnn,
                            &alpha,
                            input_descriptor,
                            input_device,
                            kernel_descriptor,
                            kernel_device,
                            convolution_descriptor,
                            convolution_algorithm.algo,
                            d_workspace,
                            workspace_bytes,
                            &beta,
                            output_descriptor,
                            output_device);

    clock_gettime(CLOCK_MONOTONIC, &time_end);

    double exec_time = (time_end.tv_nsec - time_start.tv_nsec) / 1000000000.0;

    cudaMemcpy(output, output_device, K*H*W*sizeof(double), cudaMemcpyDeviceToHost);

    double checksum = 0.0;
    for(int i=0; i<K*H*W; i++)
        checksum += output[i];

    cout<<"C3 checksum: "<<checksum<<"\t";
    cout<<"C3 execution time: "<<exec_time<<endl;

    cudaFree(input_device);
    cudaFree(output_device);
    cudaFree(kernel_device);
    cudaFree(d_workspace);

    cudnnDestroyTensorDescriptor(input_descriptor);
    cudnnDestroyTensorDescriptor(output_descriptor);
    cudnnDestroyFilterDescriptor(kernel_descriptor);
    cudnnDestroyConvolutionDescriptor(convolution_descriptor);

    cudnnDestroy(cudnn);

    free(input);
    free(output);
    free(kernel);

    return 0;
}
</code>```

Body:
I tried to write an easy 3d convolution with cudnn but I encountered a vague error msg called after a successful compilation with NVCC: CUDNN_STATUS_BAD_PARAM on the line of cudnnGetConvolutionForwardAlgorithm_v7. I checked the parameters inside this API and seemed Okay. Not know how to debug at this moment and any suggestion is appreciated. Thanks!

BTW, I am using CUDNN 8.4, CUDA 11.x and my operating system is Ubuntu 18.04. (Should not be version compatibility issue)

#include <cudnn.h>
#include <cuda.h>
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;

#define checkCUDNN(expression)                               \
  {                                                          \
    cudnnStatus_t status = (expression);                     \
    if (status != CUDNN_STATUS_SUCCESS) {                    \
      std::cerr << "Error on line " << __LINE__ << ": "      \
                << cudnnGetErrorString(status) << std::endl; \
      std::exit(EXIT_FAILURE);                               \
    }                                                        \
  }

int main(int argc, char* argv[]){
    int H = atoi(argv[1]);
    int W = atoi(argv[2]);
    int C = atoi(argv[3]);

    int FH = atoi(argv[4]);
    int FW = atoi(argv[5]);
    int K = atoi(argv[6]);

    double* input = new double[K*H*W];
    double* kernel = new double[K*C*FH*FW];

    for(int k=0; k<K; k++){
        for(int c=0; c<C; c++){
            for(int i=0; i<FH; i++){
                for(int j=0; j<FW; j++){
                    kernel[k*FH*FW*C+c*FH*FW+i*FW+j] = (c+k) * (i+j);
                }
            }
        }
    }

    for(int c=0; c<C; c++){
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                input[c*H*W+i*W+j] = c * (i+j);
            }
        }
    }
    double* output = new double[K*H*W];

    cudnnHandle_t cudnn;
    checkCUDNN(cudnnCreate(&cudnn));

    cudnnTensorDescriptor_t input_descriptor;
    checkCUDNN(cudnnCreateTensorDescriptor(&input_descriptor));
    int dimA[3] = {C, H, W};
    int strideA[3] = {1, 1, 1};
    checkCUDNN(cudnnSetTensorNdDescriptor(input_descriptor, CUDNN_DATA_DOUBLE, 3, dimA, strideA));

    cudnnFilterDescriptor_t kernel_descriptor;
    checkCUDNN(cudnnCreateFilterDescriptor(&kernel_descriptor));
    checkCUDNN(cudnnSetFilter4dDescriptor(kernel_descriptor, CUDNN_DATA_DOUBLE, CUDNN_TENSOR_NCHW, K, C, FH, FW));

    cudnnTensorDescriptor_t output_descriptor;
    checkCUDNN(cudnnCreateTensorDescriptor(&output_descriptor));
    int dimA2[3] = {K, W, H};
    int strideA2[3] = {1, 1, 1};
    checkCUDNN(cudnnSetTensorNdDescriptor(output_descriptor, CUDNN_DATA_DOUBLE, 3, dimA2, strideA2));

    cudnnConvolutionDescriptor_t convolution_descriptor;
    checkCUDNN(cudnnCreateConvolutionDescriptor(&convolution_descriptor));
    int padding[3] = {0, 1, 1};
    int strideA3[3] = {1, 1, 1};
    int dilation[3] = {1, 1, 1};
    checkCUDNN(cudnnSetConvolutionNdDescriptor(convolution_descriptor, 3, padding, strideA3, dilation, CUDNN_CROSS_CORRELATION, CUDNN_DATA_DOUBLE));

    cudnnConvolutionFwdAlgoPerf_t convolution_algorithm;
    int perf_count;
    checkCUDNN(cudnnGetConvolutionForwardAlgorithm_v7(cudnn, input_descriptor, kernel_descriptor, convolution_descriptor, output_descriptor, CUDNN_CONVOLUTION_FWD_ALGO_COUNT , &perf_count, &convolution_algorithm));

    size_t workspace_bytes = 0;
    checkCUDNN(cudnnGetConvolutionForwardWorkspaceSize(cudnn,
                                            input_descriptor,
                                            kernel_descriptor,
                                            convolution_descriptor,
                                            output_descriptor,
                                            convolution_algorithm.algo,
                                            &workspace_bytes));

    double* input_device;
    double* kernel_device;
    double* output_device;
    void* d_workspace{nullptr};
    cudaMalloc(&d_workspace, workspace_bytes);

    cudaMalloc((void **)& input_device, C*H*W*sizeof(double));
    cudaMalloc((void **)& kernel_device, K*C*FH*FW*sizeof(double));
    cudaMalloc((void **)& output_device, K*H*W*sizeof(double));

    cudaMemcpy(input_device, input, C*H*W*sizeof(double), cudaMemcpyHostToDevice);
    cudaMemcpy(kernel_device, kernel, K*C*FH*FW*sizeof(double), cudaMemcpyHostToDevice);
    cudaMemcpy(output_device, output, K*H*W*sizeof(double), cudaMemcpyHostToDevice);

    const double alpha = 1, beta = 0;

    struct timespec time_start = {0, 0};
    struct timespec time_end = {0, 0};

    clock_gettime(CLOCK_MONOTONIC, &time_start);

    cudnnConvolutionForward(cudnn,
                            &alpha,
                            input_descriptor,
                            input_device,
                            kernel_descriptor,
                            kernel_device,
                            convolution_descriptor,
                            convolution_algorithm.algo,
                            d_workspace,
                            workspace_bytes,
                            &beta,
                            output_descriptor,
                            output_device);

    clock_gettime(CLOCK_MONOTONIC, &time_end);

    double exec_time = (time_end.tv_nsec - time_start.tv_nsec) / 1000000000.0;

    cudaMemcpy(output, output_device, K*H*W*sizeof(double), cudaMemcpyDeviceToHost);

    double checksum = 0.0;
    for(int i=0; i<K*H*W; i++)
        checksum += output[i];

    cout<<"C3 checksum: "<<checksum<<"\t";
    cout<<"C3 execution time: "<<exec_time<<endl;

    cudaFree(input_device);
    cudaFree(output_device);
    cudaFree(kernel_device);
    cudaFree(d_workspace);

    cudnnDestroyTensorDescriptor(input_descriptor);
    cudnnDestroyTensorDescriptor(output_descriptor);
    cudnnDestroyFilterDescriptor(kernel_descriptor);
    cudnnDestroyConvolutionDescriptor(convolution_descriptor);

    cudnnDestroy(cudnn);

    free(input);
    free(output);
    free(kernel);

    return 0;
}


问:
How to tie ansible service account credentials to ssh key for Gitlab CI
I have a gitlab CI project set up and working for terraform by following the steps outlined here:

```<code>https://ael-computas.medium.com/gcp-workload-identity-federation-on-gitlab-passing-authentication-between-jobs-ffaa2d51be2c
</code>```

It essentially sets the following variables to be used:

```<code>    - export GOOGLE_APPLICATION_CREDENTIALS=$CI_PROJECT_DIR/_auth/.gcp_temp_cred.json
    - export CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=$CI_PROJECT_DIR/_auth/.gcp_temp_cred.json
    - export GOOGLE_GHA_CREDS_PATH=$CI_PROJECT_DIR/_auth/.gcp_temp_cred.json
    - export GOOGLE_CLOUD_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export CLOUDSDK_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export CLOUDSDK_CORE_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export GCP_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export GCLOUD_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
</code>```

This all works fine in my terraform setup, but when trying to run my ansible tasks, it doesn't seem to be using the service account. It's just using a generic service account and I can't figure out how to change it. I get this error:

```<code>ERROR: (gcloud.compute.ssh) User [ephemeral-runner@gitlab-ci-plan-free-6-xxxxx.iam.gserviceaccount.com] does not have permission to access users instance [ephemeral-runner@gitlab-ci-plan-free-6-xxxxx.iam.gserviceaccount.com] (or it may not exist)
</code>```

This is not the service account that I've set the GOOGLE_APPLICATION_CREDENTIALS variable to. Any ideas how to get it to use that account in a gitlab runner?

Thanks!

Body:
I have a gitlab CI project set up and working for terraform by following the steps outlined here:

https://ael-computas.medium.com/gcp-workload-identity-federation-on-gitlab-passing-authentication-between-jobs-ffaa2d51be2c

It essentially sets the following variables to be used:

    - export GOOGLE_APPLICATION_CREDENTIALS=$CI_PROJECT_DIR/_auth/.gcp_temp_cred.json
    - export CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=$CI_PROJECT_DIR/_auth/.gcp_temp_cred.json
    - export GOOGLE_GHA_CREDS_PATH=$CI_PROJECT_DIR/_auth/.gcp_temp_cred.json
    - export GOOGLE_CLOUD_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export CLOUDSDK_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export CLOUDSDK_CORE_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export GCP_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)
    - export GCLOUD_PROJECT=$(cat $CI_PROJECT_DIR/_auth/.GOOGLE_CLOUD_PROJECT)

This all works fine in my terraform setup, but when trying to run my ansible tasks, it doesn't seem to be using the service account. It's just using a generic service account and I can't figure out how to change it. I get this error:

ERROR: (gcloud.compute.ssh) User [ephemeral-runner@gitlab-ci-plan-free-6-xxxxx.iam.gserviceaccount.com] does not have permission to access users instance [ephemeral-runner@gitlab-ci-plan-free-6-xxxxx.iam.gserviceaccount.com] (or it may not exist)

This is not the service account that I've set the GOOGLE_APPLICATION_CREDENTIALS variable to. Any ideas how to get it to use that account in a gitlab runner?

Thanks!


问:
Django - register several template tags in one file
I'm just wondering whether it's possible to register more than one template tag in one file, like this:

```<code># (project root)/templatetags/my_inclusion_tags.py

from django.template import Library
register = Library()

def func1():
    ...
    return context

def func2():
    ...
    return context

def func3():
    ...
    return context

register.inclusion_tag('templatetages/templates/template1.html', func=func1, name='tag1')
register.inclusion_tag('templatetages/templates/template2.html', func=func2, name='tag2')
register.inclusion_tag('templatetages/templates/template3.html', func=func3, name='tag3')
</code>```

I just think it makes for a much cleaner file tree. Since my functions for the inclusion tags are like 10 lines long I think it's more messy than useful to have it in separate files.

I feel like this should be possible, although I'm not sure how to let settings.py know that these inclusion tags exist. I've tried it several different ways but haven't gotten anything to work, for example:

```<code># settings.py

TEMPLATES = [
    ...
    OPTIONS: {
        ...
        libraries: {
            'tags': 'templatetags.my_templatetags'
        }
    }
]
</code>```

And then import them with something like this:

```<code>{% load tags %}
</code>```

or

```<code>{% load tags.tag1 %}
</code>```

But like i said, I haven't gotten anything to work and i haven't been able to find any information about this anywhere.

Body:
I'm just wondering whether it's possible to register more than one template tag in one file, like this:

# (project root)/templatetags/my_inclusion_tags.py

from django.template import Library
register = Library()

def func1():
    ...
    return context

def func2():
    ...
    return context

def func3():
    ...
    return context

register.inclusion_tag('templatetages/templates/template1.html', func=func1, name='tag1')
register.inclusion_tag('templatetages/templates/template2.html', func=func2, name='tag2')
register.inclusion_tag('templatetages/templates/template3.html', func=func3, name='tag3')

I just think it makes for a much cleaner file tree. Since my functions for the inclusion tags are like 10 lines long I think it's more messy than useful to have it in separate files.

I feel like this should be possible, although I'm not sure how to let settings.py know that these inclusion tags exist. I've tried it several different ways but haven't gotten anything to work, for example:

# settings.py

TEMPLATES = [
    ...
    OPTIONS: {
        ...
        libraries: {
            'tags': 'templatetags.my_templatetags'
        }
    }
]

And then import them with something like this:

{% load tags %}

or

{% load tags.tag1 %}

But like i said, I haven't gotten anything to work and i haven't been able to find any information about this anywhere.


问:
Intercepting POST request in chrome extension, how do it properly?
I'm trying to intercept POST request made by the website and intercept the response but somehow I am not getting the correct result.

I'm trying this same on Facebook ads library and trying to fetch the response body, I can see the POST request made by checking the "Network tab" in the browser. I want to fetch those responses within the code and then save it for later use.

chrome.webRequest.onBeforeRequest.addListener(
  function (details) {
    if (details.method == "POST")
      // Use this to decode the body of your post
      var postedString = decodeURIComponent(
        String.fromCharCode.apply(
          null,
          new Uint8Array(details.requestBody.raw[0].bytes)
        )
      );
    console.log(postedString);
  },
  { urls: ["<all_urls>"] },
  ["requestBody"]
);
```

That's what I have written/checked from stackoverflow so far.

Body:
I'm trying to intercept POST request made by the website and intercept the response but somehow I am not getting the correct result.

I'm trying this same on Facebook ads library and trying to fetch the response body, I can see the POST request made by checking the "Network tab" in the browser. I want to fetch those responses within the code and then save it for later use.

chrome.webRequest.onBeforeRequest.addListener(
  function (details) {
    if (details.method == "POST")
      // Use this to decode the body of your post
      var postedString = decodeURIComponent(
        String.fromCharCode.apply(
          null,
          new Uint8Array(details.requestBody.raw[0].bytes)
        )
      );
    console.log(postedString);
  },
  { urls: ["<all_urls>"] },
  ["requestBody"]
);

That's what I have written/checked from stackoverflow so far.


问:
WooCommerce - hide / show shipping methods based on cart total
In my WooCommerce store, I would like to hide / show some shipping methods based on cart subtotal as follow:

If order is over £60 then show shipping method Free Shipping and Next Day Business Delivery

I found the code on anther thread

```<code>add_filter( 'woocommerce_package_rates', 'hide_specific_shipping_method', 10, 2 );
function hide_specific_shipping_method( $rates, $package ) {
    // Settings: define you shipping rate IDs below
    $rate_free = 'free_shipping:1'; // Free Shipping For Orders Over £60
    $rate_id_1 = 'flat_rate:2'; // Standard Delivery (1-4 Business Days)
    $rate_id_2 = 'flat_rate:7'; // Standard Delivery Second Class (2-5 Business Days)
    $rate_id_3 = 'flat_rate:3'; // Next Business Day Delivery
    $rate_id_4 = 'flat_rate:4'; // Saturday Special Deliver

    $cart_subtotal = WC()->cart->get_subtotal();
        if ( $cart_subtotal >= 60 ) {
        // Enable only methods 1 and 3
        if ( isset($rates[$rate_id_1]) )
             unset( $rates[$rate_id_1] );
        if ( isset($rates[$rate_id_2]) )
             unset( $rates[$rate_id_2] );
        if ( isset($rates[$rate_id_4]) )
             unset( $rates[$rate_id_4] );
    }
    return $rates;
}
</code>```

But the code has no effect. I don't know what has gone wrong

Body:
In my WooCommerce store, I would like to hide / show some shipping methods based on cart subtotal as follow:

If order is over £60 then show shipping method Free Shipping and Next Day Business Delivery

I found the code on anther thread

add_filter( 'woocommerce_package_rates', 'hide_specific_shipping_method', 10, 2 );
function hide_specific_shipping_method( $rates, $package ) {
    // Settings: define you shipping rate IDs below
    $rate_free = 'free_shipping:1'; // Free Shipping For Orders Over £60
    $rate_id_1 = 'flat_rate:2'; // Standard Delivery (1-4 Business Days)
    $rate_id_2 = 'flat_rate:7'; // Standard Delivery Second Class (2-5 Business Days)
    $rate_id_3 = 'flat_rate:3'; // Next Business Day Delivery
    $rate_id_4 = 'flat_rate:4'; // Saturday Special Deliver

    $cart_subtotal = WC()->cart->get_subtotal();
        if ( $cart_subtotal >= 60 ) {
        // Enable only methods 1 and 3
        if ( isset($rates[$rate_id_1]) )
             unset( $rates[$rate_id_1] );
        if ( isset($rates[$rate_id_2]) )
             unset( $rates[$rate_id_2] );
        if ( isset($rates[$rate_id_4]) )
             unset( $rates[$rate_id_4] );
    }
    return $rates;
}

But the code has no effect. I don't know what has gone wrong


问:
What does 'Bad File descriptor' mean for Flutter ios?
I keep getting 'Bad file descriptor' errors for Flutter on iOS production builds. According to Sentry, they come from the post request I am sending to the backend.

Code of post function:

```<code>            static Future<dynamic> post(
String endPoint, {
Map<String, dynamic>? body,
 }) async {
var uri = Uri.parse(_apiUrl + endPoint);
print('post: $uri');
print('body: $body');

http.Response response;

response = await http.post(
  uri,
  body: json.encode(body),
  headers: {
    'Content-type': 'application/json',
  },
);

// Check response: throws exception if not successful
_checkResponse(response);

return json.decode(response.body);
 }

 static void _checkResponse(http.Response res) {
print('_checkResponse code: ${res.statusCode}');

if (res.statusCode != 200) {
  var body = json.decode(res.body);
  print('body of error is : ${body['error']}');
  throw NetworkException(
    ExceptionError.fromMap(body['error']),
    statusCode: res.statusCode,
  );
}
</code>```

}

Body:
I keep getting 'Bad file descriptor' errors for Flutter on iOS production builds. According to Sentry, they come from the post request I am sending to the backend.

Code of post function:

            static Future<dynamic> post(
String endPoint, {
Map<String, dynamic>? body,
 }) async {
var uri = Uri.parse(_apiUrl + endPoint);
print('post: $uri');
print('body: $body');

http.Response response;

response = await http.post(
  uri,
  body: json.encode(body),
  headers: {
    'Content-type': 'application/json',
  },
);

// Check response: throws exception if not successful
_checkResponse(response);

return json.decode(response.body);
 }

 static void _checkResponse(http.Response res) {
print('_checkResponse code: ${res.statusCode}');

if (res.statusCode != 200) {
  var body = json.decode(res.body);
  print('body of error is : ${body['error']}');
  throw NetworkException(
    ExceptionError.fromMap(body['error']),
    statusCode: res.statusCode,
  );
}

}


问:
Ionic Avoid Talkback reads appname and webview
We have an Ionic APP with Angular, but for accessibility when we use Android TalkBack it start reading the AppName and WebView, but we don't want to read that part, we only want to read the content of the visible top Div ¿is that possible?

Thanks a lot for your comments.


问:
need vba code to open/save as. another file by using with data sheet
am try to write code in data sheet to monitor the other calculation spreadsheets.  Here I want to writ the code to open calculation spreadsheet as read-only and rename the opened spreadsheet with list of names from data sheet column.  ( I have already given name range for the list of policies numbers in data sheet).  my concern is that one calculation file is created then that should be closed and should create another according the next policy number in the list

I tried to open the calculation by using code in the data sheet, but I can't able to save the opened calculation s/s make it as with different names.


问:
How can I draw A and I letter in WebGL
I get the right shape when I use gl.LINE_LOOP but when I try to use gl.TRIANGLE_FAN I get an odd looking shape. I have attached my vertices as well.

```<code>vertices = new Float32Array([
   0,    0,      0.0, 1.0, 1.0,
   0,    0.7,    0.0, 1.0, 1.0,
   0.5,  0.7,    0.0, 1.0, 1.0,
   0.5,  0.6,    0.0, 1.0, 1.0,
   0.2,  0.6,    0.0, 1.0, 1.0,
   0.2,  0.5,    0.0, 1.0, 1.0,
   0.5,  0.5,    0.0, 1.0, 1.0,
   0.5,  0.4,    0.0, 1.0, 1.0,
   0.2,  0.4,    0.0, 1.0, 1.0,
   0.2,  0,    0.0, 1.0, 1.0
]);

rect1 = gl.createBuffer();
gl.bindBuffer( gl.ARRAY_BUFFER, rect1 );
gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW );

var FSIZE = vertices.BYTES_PER_ELEMENT;

// Associate out shader variables with our data buffer

var vPosition = gl.getAttribLocation( program, "vPosition" );
gl.vertexAttribPointer( vPosition, 2, gl.FLOAT, false, FSIZE * 5, 0 );
gl.enableVertexAttribArray(vPosition);

var vColor = gl.getAttribLocation(program, "vVertexColor");
gl.vertexAttribPointer(vColor, 3, gl.FLOAT, false, FSIZE * 5, FSIZE * 2);
gl.enableVertexAttribArray(vColor);

gl.drawArrays( gl.LINE_LOOP, 0, 10 );
</code>```

Title: How can I draw A and I letter in WebGL

Body:
I get the right shape when I use gl.LINE_LOOP but when I try to use gl.TRIANGLE_FAN I get an odd looking shape. I have attached my vertices as well.

vertices = new Float32Array([
   0,    0,      0.0, 1.0, 1.0,
   0,    0.7,    0.0, 1.0, 1.0,
   0.5,  0.7,    0.0, 1.0, 1.0,
   0.5,  0.6,    0.0, 1.0, 1.0,
   0.2,  0.6,    0.0, 1.0, 1.0,
   0.2,  0.5,    0.0, 1.0, 1.0,
   0.5,  0.5,    0.0, 1.0, 1.0,
   0.5,  0.4,    0.0, 1.0, 1.0,
   0.2,  0.4,    0.0, 1.0, 1.0,
   0.2,  0,    0.0, 1.0, 1.0
]);

rect1 = gl.createBuffer();
gl.bindBuffer( gl.ARRAY_BUFFER, rect1 );
gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW );

var FSIZE = vertices.BYTES_PER_ELEMENT;

// Associate out shader variables with our data buffer

var vPosition = gl.getAttribLocation( program, "vPosition" );
gl.vertexAttribPointer( vPosition, 2, gl.FLOAT, false, FSIZE * 5, 0 );
gl.enableVertexAttribArray(vPosition);

var vColor = gl.getAttribLocation(program, "vVertexColor");
gl.vertexAttribPointer(vColor, 3, gl.FLOAT, false, FSIZE * 5, FSIZE * 2);
gl.enableVertexAttribArray(vColor);

gl.drawArrays( gl.LINE_LOOP, 0, 10 );


问:
Locally installed Mastodon does not save followers from Docker setup
I would like to test Mastodon/Activitypub locally along with other projects.

I have a local development environment using Docker that I have built for myself using the https://github.com/degobbis/docker-lamp repository. The Docker environment is set up so that I can access a WordPress installation locally using the URL https://indiewebwordpress.de/. Here I installed the https://de.wordpress.org/plugins/activitypub/ plugin.

I also installed Mastodon locally using the https://docs.joinmastodon.org/dev/setup/#manual (Manual install from source) guide on the same machine. When I enter http://localhost:3000 in the browser, Mastodon starts and also works flawlessly at first glance .

I can enter @myuser@indiewebwordpress.de in the search box and find the wordpress user. I can follow the user. However, the following is not saved. If I reload the page, then the follower indication is set to zero again.
If I now switch to Sidekiq, I get the following error: "HTTP::ConnectionError: failed to connect: No address for indiewebwordpress.de on https://indiewebwordpress.de/wp-json/activitypub/1.0/users/1/inbox."[![enter image description here]2]2

If I call the URL to the Inbox https://indiewebwordpress.de/wp-json/activitypub/1.0/users/1/inbox in the browser, I get a correct JSON.

Why, Mastodon finds the wordpress installation first, but then can't save the followers?

The same happens with follow-up requests sent to mastodon.social, for example. In that case it's clear for me, because the external instance can't find my local one. However, the first two examples are both on the same machine.

In the case that this is a bug, I asked the question here too: https://github.com/mastodon/mastodon/issues/22308


问:
Docker mapping files is not visible in VSCode
I have created a Postgres docker image using the below command-

```<code> docker run -it \
 -e POSTGRES_USER="root" \
 -e POSTGRES_PASSWORD="root" \
 -e POSTGRES_DB="ny_taxi" \
 -v $(pwd)/ny_taxi_postgres_data:/var/lib/postgresql/data \
 -p 5432:5432 \
 postgres:13
</code>```

pwd = home/username/data_eng/ny_taxi_postgres_data

Now when I am using ls as root user all the files are visible under ny_taxi_postgres_data-

But when I opening the directory using Vs Code nothing is visible-

Can't understand what happening. Any help will be appreciated!!

Body:
I have created a Postgres docker image using the below command-

 docker run -it \
 -e POSTGRES_USER="root" \
 -e POSTGRES_PASSWORD="root" \
 -e POSTGRES_DB="ny_taxi" \
 -v $(pwd)/ny_taxi_postgres_data:/var/lib/postgresql/data \
 -p 5432:5432 \
 postgres:13

pwd = home/username/data_eng/ny_taxi_postgres_data

Now when I am using ls as root user all the files are visible under ny_taxi_postgres_data-

But when I opening the directory using Vs Code nothing is visible-

Can't understand what happening. Any help will be appreciated!!


问:
Why does my Android Tablet not Report Focal length or Sensor width?
So this is something that's been blocking us for a while now.

For context, we're trying to use Google's MediaPipe library on an Android tablet.

However, it crashes complaining about a Null array

```<code>    Process: com.example.jarvis, PID: 9853
    java.lang.NullPointerException: Attempt to read from null array
        at com.google.mediapipe.components.CameraXPreviewHelper.calculateFocalLengthInPixels(CameraXPreviewHelper.java:485)
        at com.google.mediapipe.components.CameraXPreviewHelper.updateCameraCharacteristics(CameraXPreviewHelper.java:472)
        at
</code>```

To investigate this further, we started looking into the Camera Characteristics returned, including making a separate APK just to see what's going on.  Relevant part is here https://github.com/onthecrow/know-your-camera/blob/main/app/src/main/java/com/onthecrow/knowyourcamera/MainActivity.kt#L86

```<code>                if (!characteristicsStateValue.characteristicsExists) {
                    Text(text = "Can't obtain the camera characteristics!")
                }
                if (!characteristicsStateValue.focalLengthCharacteristicsExists) {
                    Text(text = "Obtained characteristics doesn't contain the focal length")
                }
                if (!characteristicsStateValue.sensorWidthCharacteristicsExists) {
                    Text(text = "Obtained characteristics doesn't contain the sensor width")
                }
</code>```

It seems like LENS_INFO_AVAILABLE_FOCAL_LENGTHS and SENSOR_INFO_PHYSICAL_SIZE are null when they shouldn't be.  We're running Android 11, and these seem like they're supposed to always be present https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS

Any ideas what's going on?
We have also considered trying to find the right Camera Characteristics some other way and then hard coding them into the Dict before they're read - not ideal but possible if we could figure it out.

Body:
So this is something that's been blocking us for a while now.

For context, we're trying to use Google's MediaPipe library on an Android tablet.

However, it crashes complaining about a Null array

    Process: com.example.jarvis, PID: 9853
    java.lang.NullPointerException: Attempt to read from null array
        at com.google.mediapipe.components.CameraXPreviewHelper.calculateFocalLengthInPixels(CameraXPreviewHelper.java:485)
        at com.google.mediapipe.components.CameraXPreviewHelper.updateCameraCharacteristics(CameraXPreviewHelper.java:472)
        at

To investigate this further, we started looking into the Camera Characteristics returned, including making a separate APK just to see what's going on.  Relevant part is here https://github.com/onthecrow/know-your-camera/blob/main/app/src/main/java/com/onthecrow/knowyourcamera/MainActivity.kt#L86

                if (!characteristicsStateValue.characteristicsExists) {
                    Text(text = "Can't obtain the camera characteristics!")
                }
                if (!characteristicsStateValue.focalLengthCharacteristicsExists) {
                    Text(text = "Obtained characteristics doesn't contain the focal length")
                }
                if (!characteristicsStateValue.sensorWidthCharacteristicsExists) {
                    Text(text = "Obtained characteristics doesn't contain the sensor width")
                }

It seems like LENS_INFO_AVAILABLE_FOCAL_LENGTHS and SENSOR_INFO_PHYSICAL_SIZE are null when they shouldn't be.  We're running Android 11, and these seem like they're supposed to always be present https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS

Any ideas what's going on?
We have also considered trying to find the right Camera Characteristics some other way and then hard coding them into the Dict before they're read - not ideal but possible if we could figure it out.


问:
Set gradient of transparency is polygon tkinter
I am creating a green polygon with tkinter. But, I would like to add some transparency on the polygon.
I.e., I don't want that the polygon has no fill. I just want that the opacity of the color becomes lesser so that I can see what is in the background. Is it possible to do it in tkinter?

And it must be a polygon and not a rectangle.

```<code>self.canvas.create_polygon(*pts, outline="black",
                                           fill=(0,255,0), self.opacity_slider.get()/100), width=2)
</code>```

Body:
I am creating a green polygon with tkinter. But, I would like to add some transparency on the polygon.
I.e., I don't want that the polygon has no fill. I just want that the opacity of the color becomes lesser so that I can see what is in the background. Is it possible to do it in tkinter?

And it must be a polygon and not a rectangle.

self.canvas.create_polygon(*pts, outline="black",
                                           fill=(0,255,0), self.opacity_slider.get()/100), width=2)