In the master-worker architecture, should a worker have only one teacher?

  1. In the master-worker architecture,

    • Should a worker be created by his own teacher?
    • Should a worker have only one teacher, but not more than one?
  2. When a client requests some resource from a server, is there a
    master-worker relationship between client and server?

  3. In a teacher-worker relationship, do a teacher and their workers also have a client-server relationship?

Thank you.

In the master-worker architecture, should a worker have only one teacher?

  1. In the master-worker architecture,

    • Should a worker be created by his own teacher?
    • Should a worker have only one teacher, but not more than one?
  2. When a client requests some resource from a server, is there a
    master-worker relationship between client and server?

  3. In a teacher-worker relationship, do a teacher and their workers also have a client-server relationship?

Thank you.

android: is it possible to get a LifecycleOwner from a worker (or related class)?

I know that Serivces, Activities and Fragments are LifecycleOwners, but I can't seem to find a way to get a LifecycleOwner from a Worker. Is that possible?

Context: I am migrating some tasks that used to run Activities and Services, so that Worker runs them as part of the WorkManager framework. Some of this code provides a LifecycleOwner through "this", but in a Worker I no longer have those references.

How to return the department head of the department with the worker who has served the longest?

Scenario / Problem
I have a table that stores the identification of the workers, when they start working in a department and when they leave that department. This can be seen in SQL Fiddle: http://www.sqlfiddle.com/#!9/d0c982/1/0

The following code will create the table and insert the test data.

CREATE TABLE `Worker_Department` (
  `Worker_ID` Integer NOT NULL ,
  `Department_ID` Integer NOT NULL,
  `Position` Text NOT NULL,
`Start_Date` datetime NOT NULL,
`Leave_Date` datetime
);

  INSERT INTO `Worker_Department`(`Worker_ID`,`Department_ID`,`Position`,`Start_Date`)
  VALUES
  (10,100,'Leader','1980-11-11'),
  (20,200,'Leader','1980-11-11');


  INSERT INTO
`Worker_Department`(`Worker_ID`,`Department_ID`,`Position`,`Start_Date`,`Leave_Date`)
  VALUES
  (30,200,'Administrator','1980-11-11', '2014-02-02'),
  (40,200,'Receptionist','1975-11-11', '2014-02-02');

  INSERT INTO `Worker_Department`(`Worker_ID`,`Department_ID`,`Position`,`Start_Date`)
  VALUES
  (50,300,'Administrator','2014-02-02'),

  (30,100,'Administrator','2014-02-02');

Code (SQL):

I need to write a query that gets the worker with the longest service time currently in a department (a null end date). However, those with the "Leader" position are not eligible to be the longest portion. From the results of this consultation, I will have to find the department leader in the department in which the worker with more time is currently working.

Expected result
Looking at the test data provided:

  • Worker 40 may not be the employee with more service time since he no longer works for the company.
  • Workers 10 and 20 cannot be the employee with the longest service time since they both have the position of leader (However, this will make them eligible to be the department leader based on who is the employee with the most service time) .
  • Worker 30 is the employee with the longest service time because there is a greater difference between the current date and the oldest start date compared to worker 50.
  • Worker 30 currently works in department 100. This means that Worker 10 is the department leader in the department with the oldest worker

The result of the query would be something like
The | Worker ID
| —————
The | 10
SEMrush

If this table was linked as a foreign key to another table, the selection could be modified to include details about that leader (name, phone, address).

Current progress
The following query will show the workers who are currently working (those without a license date), the department in which they work and their role in that department.

SELECT Worker_ID, Department_ID, Position FROM Worker_Department
   WHERE position != 'Leader' AND leave_date is null

Code (SQL):

The consultation below will return the difference between the current date and the minimum start date of the worker. However, this includes those who do not have a null (non-current) end date.

SELECT Worker_ID, DATEDIFF(Now(), Min(Start_Date)) as NowSubMin FROM Worker_Department
WHERE position != 'Leader'
GROUP BY Worker_ID

Code (SQL):

Finally, both queries have been used to create the following query that is designed to return to workers currently working together with the difference in date between the current date and their first start date.

SELECT Worker_ID, DATEDIFF(Now(), Min(Start_Date)) as NowSubMin FROM Worker_Department
WHERE position != 'Leader'
GROUP BY Worker_ID

HAVING Worker_ID IN (SELECT Worker_ID FROM Worker_Department
   WHERE position != 'Leader' AND leave_date is null)

Code (SQL):

ubuntu – Nginx reaches worker connection limit

I am managing an Nginx server that occasionally drops a lot of connections, after inspecting the records I can see that the worker_connections the limit is being reached, p.

2019/12/06 08:37:09 (alert) 14517#14517: 25000 worker_connections are not enough

I can see from my metrics that Nginx starts losing connections after reaching 20k active connections despite the fact that there are 32 (automatic) workers, each of whom should be able to handle 25,000 connections (if my understanding is correct).

Things I have tried:

  • Increase worker connection limit
  • Converted multi_accept in
  • Epoll enabled: I could see that most of the load was handled by 2-3 work processes and others were practically not used, although this did not seem to really help the situation, since the PID shown in the error log is almost always the same process.

I am really perplexed with what else to try, if anyone has any suggestions on what might be causing it, it would be greatly appreciated.

Other relevant information:

  • 32 CPU, 64 GB of memory
  • Ubuntu v18.04.3
  • The connections are being represented upstream
  • Nginx has an average of around 400 RPS

Open MPI: simple manager / worker pattern in C

I am currently modifying a research project (massive proof and reference point of various conjectures to try to solve the SSW conjecture) so it can run in a great HPC architecture, which does not handle most of the methods & # 39; classics & # 39; multiprocess / multithreaded (such as those based on fork in C, python multiprocessing module or multi-threaded libraries).

So I have to go for an OpenMPI based implementation.

I need advice on the manager / worker employer, and on the & # 39; good and legitimate & # 39; of using open MPI, including good practices. I'm also taking advice on coding style and tastes, but it's not the main problem here (academic laboratory coding style :-)).

The rest of the code (the actual work to be done) is working well, compared, tested and … confidential. So Here is a toy box, where a job will consist of printing an integer, sleeping for a short period of time and not returning any information to the manager. Error handling for workers is also handled at the worker level, so we don't need to really worry about this here.

The principle is as follows: I have a & # 39; manager & # 39; that sends jobs to perform to several workers (a few thousand in my case). Each worker is totally independent., and you do not need to return any information to your manager. Workers 'errors are handled in the workers' code.

Here is my toy program:

/* file: test_mpi.c */

#include 
#include 
#include 
#include 
#include 

#define KEEP_WORKING 0
#define NO_MORE_JOBS 1
#define READY_TO_WORK 2
#define WORKER_NOT_AVAILABLE -1
#define MANAGER_RANK 0
#define NB_JOBS 8


int get_rank_from_ready_worker() {
    MPI_Status status;
    int worker_useless_msg;
    MPI_Recv(&worker_useless_msg,
             1,
             MPI_INT,
             MPI_ANY_SOURCE,
             MPI_ANY_TAG,
             MPI_COMM_WORLD,
             &status);

    if (status.MPI_TAG == READY_TO_WORK) {
        return status.MPI_SOURCE;
    } else {
        return WORKER_NOT_AVAILABLE;
    }
}


void send_job_to_worker(int job, int worker_rank) {
    MPI_Send(&job,
             1,
             MPI_INT,
             worker_rank,
             KEEP_WORKING,
             MPI_COMM_WORLD);
}


void signal_to_manager_that_ready() {
    int empty_msg = 0;
    MPI_Send(&empty_msg,
             1,
             MPI_INT,
             MANAGER_RANK,
             READY_TO_WORK,
             MPI_COMM_WORLD);
}


void do_job(int job, int my_rank) {
    unsigned int sleep_time = 1 + ((rand() + job) % 4);
    sleep(sleep_time);
    printf("(%d) performed job %dn",
           my_rank, job);
}


bool receive_job_from_manager(int my_rank) {
    int job;
    MPI_Status status;
    MPI_Recv(&job,
             1,
             MPI_INT,
             MANAGER_RANK,
             MPI_ANY_TAG,
             MPI_COMM_WORLD,
             &status);

    if (status.MPI_TAG == KEEP_WORKING) { /* received a job to perform */
        do_job(job, my_rank);
        /* tell manager that it's ready to perform a new job */
        signal_to_manager_that_ready();
        return true;

    } else if (status.MPI_TAG == NO_MORE_JOBS) { /* work is over ! */
        return false;
    } else { /* this should not happen */
        return false;
    }
}

void terminate_worker(int worker_rank) {
    int empty_job = 0;
    MPI_Send(&empty_job,
             1,
             MPI_INT,
             worker_rank,
             NO_MORE_JOBS,
             MPI_COMM_WORLD);
}


int main(int argc, char** argv) {
    /* init MPI environment */
    MPI_Init(&argc, &argv);

    /* Find out rank, size */
    int world_rank, world_size;
    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
    MPI_Comm_size(MPI_COMM_WORLD, &world_size);

    /* Check that we have at least one manager & one worker */
    if (world_size < 2) {
        fprintf(stderr, "World size must be greater than 1 for %sn", argv(0));
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    if (world_rank == MANAGER_RANK) { /* manager part */
        /* create 'jobs'*/
        int jobs(NB_JOBS);
        for (int i = 0; i < NB_JOBS; i++) {
            jobs(i) = i;
        }

        int job_to_send = 0, worker_rank;
        do { /* manager main loop: sending jobs to ready workers */
            worker_rank = get_rank_from_ready_worker();
            if (worker_rank != WORKER_NOT_AVAILABLE) {
                send_job_to_worker(jobs(job_to_send), worker_rank);
                job_to_send ++;
            }
        } while (job_to_send < NB_JOBS);

        /* All jobs done -> terminating workers */
        for (int nb_terminated = 0; nb_terminated < world_size-1; nb_terminated++) {
            terminate_worker(get_rank_from_ready_worker());
        }

    } else { /* worker part */
        /* signal to manager that it's ready to work */
        signal_to_manager_that_ready();

        /* start working loop */
        bool keep_working;
        do {
            keep_working = receive_job_from_manager(world_rank);
        } while (keep_working);
    }

    MPI_Barrier(MPI_COMM_WORLD);
    MPI_Finalize();
    return 0;
}

To compile and run (in unix):

mpicc test_mpi.c -o test_mpi -Wall -Wextra
mpirun -n 4 ./test_mpi

Note that to compile and execute this code, Open MPI must be installed on the machine.

etl – Best practice for sharing code and data between airflow worker nodes?

New to Apache Airflow and curious about how code and data are expected to be used on workers' nodes in a multi-node airflow configuration.

When considering whether the ETL logic should be in the dags or in separate files called by the operators in the dag, from here (https://www.astronomer.io/guides/dag-best-practices/) I see:

Try to treat the DAG file as a configuration file and leave all the heavy work for the hook and operator.

From this, my question is: 1) what is the best way to synchronize the operator code between workers in a multi-node airflow configuration? And 2) given a multi-node configuration, are we expected to mount shared units among all workers to store intermediate data (or does the airflow have some other internal way of passing data between workers to complete dag tasks)?

The airport worker at the UK airport made us miss our flight (short version)

This happened yesterday at Stansted airport, which currently has detour routes on the way to some of its doors. Our door was 34.

Traveling with a baby, we decided to take the elevator instead of an escalator on the way to our door. The options were the current floor, only personal (access card and pin required), floor at doors 20-39.

Our elevator ended up stopping at the only staff floor when we met a tough airport worker who told us that we were lying about how we got there and did not allow us to continue the elevator to the correct floor, but instead made us follow it backwards. closed doors. Then he indicated the wrong address and we ended up missing our flight. His professionalism was non-existent and extremely condescending.

Since then, the boarding gate staff, the arrival desk, Ryanair customer service and the airport information desk told us that the detours were known by the airport staff and that the elevator we took was the right one and they would have advised the same thing when traveling with a walker.

Have any of you ever had to file a complaint against airport staff and have any advice that would be more effective?

We don't have the names of the people, however, the information desk told us that they could determine who it was if they checked the cameras and the records on the cards used in that elevator.

Data entry work is done completely here for $ 20

I am a data entry worker. If you give me a data entry job, I will do it very carefully and without problems.
If you work more than I can pay you a discount.

by: Jojo22
Created: –
Category: Data entry
Viewed: 341


.