Processing Dependency Printing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Processing Dependency Printing
# 1  
Old 10-26-2012
Processing Dependency Printing

Gurus,

I came across a typical requirement where the input is like-

TRANS FIRM
DEPT CUST
TRANS CUST
TRANS DEPT
FIRM CUST

& the expected Output is-

CUST
DEPT
FIRM
TRANS

This is basically a dependency list for processing the tables where
FIRM is feeding data to TRANS table
CUST is feeding data to DEPT table
CUST is feeding data to TRANS table
DEPT is feeding data to TRANS table
& CUST is feeding data to FIRM table.

Due to the feeding mechanism, the FIRM table should be available even before the TARNS is being processed, but since TRANS is depended upon CUST, CUST should be processed even before & likewise.

Finally the typical sequence of execution should be like-

CUST
DEPT
FIRM
TRANS

Appreciate your help in this regard Smilie
# 2  
Old 10-26-2012
What do you need?
# 3  
Old 11-01-2012
Basically I have a file say tmp.txt where the text is-

TRANS FIRM
DEPT CUST
TRANS CUST
TRANS DEPT
FIRM CUST

& based on the dependency listed in the file, with any command, the output should be

CUST
DEPT
FIRM
TRANS

I am trying with awk/ loops however it doesnt seem to work.. :-(
# 4  
Old 11-01-2012
So, you are normalizing a graph into an ordered list. The list of upstream input nodes is the right column made unique. The list of downstream output nodes is the right column. Sometimes it is easier to work backward from the outputs, in case some inputs are not needed. However, the list of all nodes is the uniqu sum of the irght and left column lists, the starting points have no dependency and the end points have no node dependent on them. Make the list of independent input nodes, printing them and moving them from the original total list to the done list, then print and move the nodes that depend on them, recursive until there is nobody dependent on the listed nodes (first list is empty).

To be robust, you need to deal with not needed and multiple dependencies forward and backward, which is why it is cleaner to start with the output and go back, building the output list from the end by adding discovered dependent nodes before the output (no dependents) nodes, being careful not to list any node twice. It is assumed that external users want all the nodes with no internal dependents. Think of the nodes as in layers on the graph: final, final-1, final-2, etc. Of course, CUST might seem final-1 but because of DEPT it needs to be promoted to final-2, which, since it is the same final, says that dependency TRANS CUST is actually inplicit and not needed. For multiple final, it could be initially TRANS-1 but promoted to TRANS-2. If there was anopther final product XXXX where CUST was XXXX-1, it could also be TRANS-2, and for simplicity it could be considered final-2, as if all final-2 are done before final-1, the final-1 need is met. Starting from output, like make, means things not needed are ignored.

If you start adding processing times to the mix, you can derive the end to end time for parallel processing and the critical path.

Last edited by DGPickett; 11-01-2012 at 11:36 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get the missing dependency from two files

#cat hwlock-full.dep libx11-6 >= 1.4.4 libz1 >= 1.2.7 libtinfo5 >= 5.9 libxcb1 >= 1.8.1 numactl >= 2.0.8+rc4 libpixman-1-0 >= 0.29.2 libxml2 >= 2.7.8 libxext6 >= 1.3.1 libxrender1 >= 0.9.7 libfreetype6 >= 2.4.9 libxcb-render0 >= 1.8.1 libcairo2 >= 1.12.14 libc6 >= 2.15 libxcb-shm0... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

2. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

3. Shell Programming and Scripting

Recursive file processing from a path and printing output in a file

Hi All, The script below read the path and searches for the directories/subdirectories and for the files. If files are found in the sub directories then read the content of the all files and put the content in csv(comma delimted) format and the call the write to xml function to write the std... (1 Reply)
Discussion started by: Optimus81
1 Replies

4. UNIX for Dummies Questions & Answers

make -j dependency

Hi, I had a make file, something like that, all: cd dir1; make cd dir2; make the problem is the makefile under dir2 need some objs from dir1, so I need to set some dependency let dir2 run only after the dir1 run is done. how to set the dependency? Thanks. peter (2 Replies)
Discussion started by: laopi
2 Replies

5. Programming

Fortran dependency checking

Hello, I'm creating an add-on for a large piece of software written in Fortran. In my directory I reference subroutines in other directories, which in turn reference more subroutines. I'm running into trouble because on occasion the developers of the main software change some sub calls. ... (2 Replies)
Discussion started by: kudude
2 Replies

6. Shell Programming and Scripting

How to make parallel processing rather than serial processing ??

Hello everybody, I have a little problem with one of my program. I made a plugin for collectd (a stats collector for my servers) but I have a problem to make it run in parallel. My program gathers stats from logs, so it needs to run in background waiting for any new lines added in the log... (0 Replies)
Discussion started by: Samb95
0 Replies

7. Infrastructure Monitoring

Weird dependency problem!

Hi, I want to install net-snmp-devel package but i have following dependecy problem. It's very odd, i don't get it. One of packages is depended on the other one, the other one is depended on the previous one as well. :S :S Could you help me please? Here are the steps: # ls -l total... (4 Replies)
Discussion started by: oduth
4 Replies

8. Solaris

Dependency problem

Hi all am new to solaris ............ i installed amanda client pkg that time am getting lots of dependency problem.......... is there any Yum server like things in solaris Regards ' prAn (8 Replies)
Discussion started by: pran
8 Replies

9. UNIX for Dummies Questions & Answers

process dependency

how to find all the processes associated with a given process in unix,is there any command for this. (3 Replies)
Discussion started by: laddu
3 Replies
Login or Register to Ask a Question