Electric commander - Set a property based on the status of the status of a step - build-process

I have an ecloud procedure which has few steps in it. I want to set the value of a property based on the status of the step after its completion.
E.g
Procedure P1
has steps
S1 - Runs a command
S11 - Set a property value based on the status of S1
S2 - Runs a command
S12 - Set a property value based on the status of S2
Any pointer is appreciated.
If I can set the property value in S1 and S2 in that same step then i dont need S11 and S12

They way I achieved this is by checking the outcome of step S1 in S11
S11 will have a run condition $[/javascript ('$[/myJob/jobSteps/S1/outcome]' == 'success')]
and in the S11 command we can set the property ectool setProperty /myProject/TestProperties/S1 success

Related

Matching records between two tables

I have the below code to do matching between two different tables. The code only updates the first record as "Matched".
I want to compare each record in ID field from T1 if it present in T2, e.g. To check if A present in T2 then go to next record in T1 and check B if it present in T2 through loop until all records in T1 matched
Table 1
ID
A
B
C
Table 2
ID
A
B
Expected Matching Results
ID
A
B
Any help please
If rs2("ID").Value = rs1("ID").Value Then
rs2.MoveNext()
Do While Not rs2.EOF()
rs1("Matching").Value = "Matched"
rs1.Update()
rs2.MoveFirst()
Loop
End If
Assuming I'm understanding your problem correctly, you just want to update the "Matching" column in T1 if there's a corresponding ID record in T2. Doing this in SQL would be ideal, as Peter said.
If you really want to loop, Peter is correct that you have an endless loop: you exit when you hit the end of the record set, but at the end of each iteration you are resetting back to the first record.
I don't know why you are looping through rs2 when you already found a match. Once you know that rs1("ID").Value = rs2("ID").Value then just update the Matching record in rs1 and call rs2.MoveFirst() so you can start back at the top when trying to find a match for the next ID in T1. No loop is required here.

Read After Write(RAW) HAZARD

I am confused in finding RAW dependencies whether we have to find only in adjacent instructions or non-adjacent also.
consider the following assembly code
I1: ADD R1 , R2, R2;
I2: ADD R3, R2, R1;
I3: SUB R4, R1 , R5;
I4: ADD R3, R3, R4;
FIND THE NUMBER OF READ AFTER WRITE(RAW) DEPENDENCIES IN THE Above Code.
assume ADD x,y,z = x <- y + z
I am getting 2 dependency I2-I1 and I4-I3.
Let us say that after an instruction enters the pipeline, it will take it x stages after which any register write by that instruction will be visible to any following instruction.
Then you have to take care of the RAW dependencies among every set of x consecutive instructions. In the worst case you can take x to be the max no. of stages in the pipeline.
Now, the case in the question looks like a HW problem and since the pipeline structure is not defined so you will have to look at the RAW dependencies over all the instructions, which in this case are:
I2 and I1 over R1
I3 and I1 over R1
I4 and I2 over R3
I4 and I3 over R4

Why is this SQL returning "Invalid Number" when I convert VARCHAR2 to an INTEGER?

I have this SQL:
SELECT C1,CAST(C1 as NUMBER) FROM my_materialized_view WHERE C1 IS NOT NULL AND C1 != '0'
C1 is a VARCHAR2 column that contains nulls and 0 values. Those are filtered out in the WHERE clause. This query works if I SELECT C1 FROM - remove the CAST() - from the statement.
When I run the above SQL in its entirety, I get ORA-01722: invalid number.
How should I convert a column in the materialized view to a number so I can perform calculations?
UPDATE - I also tried select cast(c1 as integer) as suggested in comments. It returns the same error.
UPDATE - I ran this select C1 from my_materialized_view where C1 IS NOT NULL and C1 != '0' order by C1 and did not find any values outside the range of 1001000 to 999300. Seems like a valid test.
This means that some values in C1 column are not numeric strings. You cannot cast a string like '1 0' (with space in between) into number for example.
Try using SELECT C1 WHERE ISNUMERIC(C1) = 0 to determine where the problematic value is.
For Oracle:
http://odiexperts.com/is_number-at-oracle-a-work-around/

Upon defining a new constant update the names of other constants

I have some logic that test for changes in values. As a certain threshold is reached a new constant claims the first spot, which is s0, and the rest are "pushed up" meaning the first becomes the second and the second becomes the third...Here is an example:
the initial state of my data might look like this:
s3 <- 7
s2 <- 5
s1 <- 4
s0 <- 2
Some test is run and s0 is redefined to a lower value like s0 = 1. at that time my variables need to be shifted up and a new "level" added as follows:
s4 <- 7
s3 <- 5
s2 <- 4
s1 <- 2
s0 <- 1
I know how to redefine s0 but I am not sure how to adjust the name of the other constants accordingly. Any help would be greatly appreciated.
You should have all these values in one vector, instead of stored as separate objects.
Initial state:
state <- c(2, 4, 5, 7)
Update state if new_value is less than all previous values:
if (new_value < min(state)) state <- sort(c(state, new_value))
Then you can always reference the current minimum value by state[1].
Not very efficient and I don't recommend this method. As commented/answered you should put your variables in the same structure ( list or vector). I show it just because the solution use some useful functions to deal with variable defines in the global environment ( switch from separate variables to a list and vice versa) .
That's said, here I define a function that do the job. It defines a new s0 and shift the name of others variables. Internally the function create a list (by gathering variable using some pattern) , shift its names and return again a separate variable to the global environment.
push <- function(value){
## call of gloabl variable twice here , once for ls and for mget
## not really elegant!
oo = mget(ls(pattern='s[0-9]+',envir=.GlobalEnv),envir=.GlobalEnv)
list2env(setNames(c(value,oo),c(names(oo),paste0('s',length(oo)))),
envir=.GlobalEnv)
}
Then you can redefine a new s0 like this :
push(1)
You test the result :
unlist(mget(ls(pattern='s[0-9]+')))
s0 s1 s2 s3 s4
1 2 4 5 7

Data manipulation using a script

I have data in the following format :
Key1:Value1 Key2:Value2 Key3:Value3
A
B
C
D
Key1:Value4 Key2:Value5 Key3:Value6
A1
B1
C1
Key1..
and so on. The number of keys is always three, and in this same order. No extra lines between the values A,B,C,D in the original data set.
I want to get output in the format
Value3, A B C D
Value6, A1 B1 C1
.
.
.
Any thoughts on a script I might be able to use to get this done
Regular expressions can help you but depends on what type of values those are in general you can write it up to match for Key3: [Pattern to match value] and graph that and then all successive lines before the next Key1 can be grabbed manually with a for loop and stop until you get to new key line and repeat for each section.
Pseudocode:
current_key = ""
while !EOF:
line = next_line()
if line has regular expression for "Key3: Value":
process for Value
current_key = Value
else
process line as a regular ABCD value and print or whatever
There isn't much error checking but hopefully that helps get you going.

Resources