How to only allow a specific machine to run a task in Luigi

Sam Tuson

Machine A has the ability to access a SQL database and Machine B has the ability to access Google Drive. How do I make sure that a task is run on the correct machine if UploadToDrive depends on DownloadSQLData somewhere down the line?

Currently Machine A runs DoSomethingElseWithData and Machine B runs UploadToDrive a few minutes later. This is fine up until the point where one day Machine A might not be working, at which point Machine B will attempt DownloadSQLData as an upstream dependency and fail.

class DownloadSQLData(luigi.Task):

    # ...

    def run(self):
        # Only Machine A can do this
        # ...

class TransformData(luigi.Task):

    # ...

    def requires(self):
        return DownloadSQLData(date=self.date)

class UploadToDrive(luigi.Task):

    # ...

    def requires(self):
        return TransformData(date=self.date)

    def run(self):
        # Only Machine B can do this
        # ...

class DoSomethingElseWithData(luigi.Task):

    #...

    def requires(self):
        return TransformData(date=self.date)

The SQL database from this example is, in reality, not a SQL database but an old system within our company. It does not fail gracefully when unauthorised users try to access it and we'd like to avoid any attempts from Machine B to do so.

iHowell

Luigi itself cannot do scheduling, i.e., running certain tasks on certain machines or scheduling tasks to run at a certain time. That being said, there are many ways to achieve what you want.

Solution 1: Let's introduce machine C that has access to machines A and B. Using a number of tools (https://wiki.python.org/moin/SecureShell) machine C could run tasks to retrieve data from A, transform it on C, and then transfer to B before uploading.

Solution 2: This solution is most likely too much work and/or infeasible. Set up machines A,B,C in a network scheduler (something like slurm https://www.schedmd.com/) with C as the head scheduler and specify A and B as certain types of resources (possibly SQL and GDrive). Then, from C, schedule slurm tasks as luigi jobs (https://github.com/pharmbio/sciluigi can help with this). These slurm tasks should specify the given resources needed for each task. And that's it!

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to reset luigi task status?

分類Dev

How to run a pipeline only on changes in a specific branch?

分類Dev

Spring Cloud - how to allow access to endpoint for specific microservice only?

分類Dev

Spring Cloud - how to allow access to endpoint for specific microservice only?

分類Dev

Spring Cloud - how to allow access to endpoint for specific microservice only?

分類Dev

How to run a task ONLY on modified file with Gulp watch

分類Dev

Run task only if host does not belong to a group

分類Dev

ansible if else statement to run only required task

分類Dev

How to allow to only one dot?

分類Dev

how to run setuid task properly?

分類Dev

How to allow a slave node run parallel jobs?

分類Dev

Allow anonymous access to only one specific Jenkins view or job

分類Dev

Allow only traffic to specific IP ranges to go through VPN

分類Dev

How to allow specific SSL client certificates in Nginx?

分類Dev

How to allow only numbers, dots and signals?

分類Dev

How to validate a Jtextfield to only allow letters in Java?

分類Dev

How to allow laravel api only for mobile app?

分類Dev

How to allow assign only users with specified role?

分類Dev

Ant task to run an Ant target only if a file exists?

分類Dev

Ant task to run an Ant target only if a file exists?

分類Dev

How can I reproduce commands run on one machine on another machine?

分類Dev

How do I run a mix task from within a mix task?

分類Dev

Inno Setup Task checked only if a specific Component is selected

分類Dev

How to run machine code as a function in c++

分類Dev

how to run complex awk command on remote machine

分類Dev

How to setup my machine to run as a web proxy?

分類Dev

How to stop a Airflow DAG run from task

分類Dev

How to use windows task scheduler to run updatedb?

分類Dev

jQuery run function only in a div that has anoher div with specific class

Related 関連記事

  1. 1

    How to reset luigi task status?

  2. 2

    How to run a pipeline only on changes in a specific branch?

  3. 3

    Spring Cloud - how to allow access to endpoint for specific microservice only?

  4. 4

    Spring Cloud - how to allow access to endpoint for specific microservice only?

  5. 5

    Spring Cloud - how to allow access to endpoint for specific microservice only?

  6. 6

    How to run a task ONLY on modified file with Gulp watch

  7. 7

    Run task only if host does not belong to a group

  8. 8

    ansible if else statement to run only required task

  9. 9

    How to allow to only one dot?

  10. 10

    how to run setuid task properly?

  11. 11

    How to allow a slave node run parallel jobs?

  12. 12

    Allow anonymous access to only one specific Jenkins view or job

  13. 13

    Allow only traffic to specific IP ranges to go through VPN

  14. 14

    How to allow specific SSL client certificates in Nginx?

  15. 15

    How to allow only numbers, dots and signals?

  16. 16

    How to validate a Jtextfield to only allow letters in Java?

  17. 17

    How to allow laravel api only for mobile app?

  18. 18

    How to allow assign only users with specified role?

  19. 19

    Ant task to run an Ant target only if a file exists?

  20. 20

    Ant task to run an Ant target only if a file exists?

  21. 21

    How can I reproduce commands run on one machine on another machine?

  22. 22

    How do I run a mix task from within a mix task?

  23. 23

    Inno Setup Task checked only if a specific Component is selected

  24. 24

    How to run machine code as a function in c++

  25. 25

    how to run complex awk command on remote machine

  26. 26

    How to setup my machine to run as a web proxy?

  27. 27

    How to stop a Airflow DAG run from task

  28. 28

    How to use windows task scheduler to run updatedb?

  29. 29

    jQuery run function only in a div that has anoher div with specific class

ホットタグ

アーカイブ